mirror of
https://github.com/lemeow125/Borrowing-TrackerBackend.git
synced 2024-11-16 22:09:27 +08:00
Fix username in registration
This commit is contained in:
parent
7b511e0d8c
commit
83580f9aa5
1 changed files with 2 additions and 1 deletions
|
@ -21,6 +21,7 @@ class CustomUserSerializer(BaseUserSerializer):
|
|||
|
||||
|
||||
class UserRegistrationSerializer(serializers.ModelSerializer):
|
||||
username = serializers.CharField(required=True)
|
||||
email = serializers.EmailField(required=True)
|
||||
course = serializers.ChoiceField(
|
||||
choices=CustomUser.COURSE_CHOICES, allow_blank=True, allow_null=True)
|
||||
|
@ -32,7 +33,7 @@ class UserRegistrationSerializer(serializers.ModelSerializer):
|
|||
model = CustomUser # Use your custom user model here
|
||||
fields = ('username', 'email', 'password', 'course', 'section',
|
||||
'first_name', 'last_name')
|
||||
read_only_fields = ('username', 'email', 'is_teacher', 'is_technician')
|
||||
read_only_fields = ('email', 'is_teacher', 'is_technician')
|
||||
|
||||
def validate(self, attrs):
|
||||
user = self.Meta.model(**attrs)
|
||||
|
|
Loading…
Reference in a new issue