Compare commits

...

2 commits

Author SHA1 Message Date
14f9487919
Fix: comments in user serializer 2025-04-10 22:35:55 +02:00
c89f40aa1f
Remove: old comment 2025-04-10 22:34:47 +02:00
2 changed files with 7 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# api/user/management/commands/backfill_user_profiles.py
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from api.user.models import UserProfile # assuming you have a UserProfile model
from api.user.models import UserProfile
class Command(BaseCommand):

View file

@ -30,9 +30,13 @@ class UserSerializer(serializers.ModelSerializer):
# Update the UserProfile instance
if profile_data:
userprofile_instance = instance.userprofile # The related UserProfile instance
userprofile_instance = (
instance.userprofile
) # The related UserProfile instance
profile_serializer = self.fields["profile"] # Get the nested serializer
profile_serializer.update(userprofile_instance, profile_data) # Update the UserProfile
profile_serializer.update(
userprofile_instance, profile_data
) # Update the UserProfile
# Update the User fields
for attr, value in validated_data.items():