fix(user-management): pagination, duplicate profile creation, type fixes

This commit is contained in:
Andrej Spielmann
2026-03-26 17:03:38 +01:00
parent 9c8acfd30e
commit b3a005f3bf
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -88,7 +88,8 @@ class UserCreateSerializer(serializers.ModelSerializer):
def create(self, validated_data):
role = validated_data.pop('role', 'trainer')
user = User.objects.create_user(**validated_data)
UserProfile.objects.create(user=user, role=role)
user.profile.role = role
user.profile.save(update_fields=['role'])
return user