fix: user can change avatar

This commit is contained in:
2023-12-11 12:43:36 +01:00
parent c3c83b3168
commit df436e0b88
2 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ class ProfileViewSet(viewsets.ModelViewSet):
profile: ProfileModel = ProfileModel.objects.get(pk=self.request.user.pk)
avatar = self.request.data.get("file", None)
if (avatar is not None):
if (profile.avatar_url.name != "default.avif"):
if (profile.avatar_url.name != "./profiles/static/avatars/default.avif"):
profile.avatar_url.storage.delete(profile.avatar_url.name)
profile.avatar_url = avatar
profile.save()