From 268bde7f492642cfb1d79aa80b1ec049aa065bca Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Mon, 26 Jun 2023 23:56:51 +0800 Subject: [PATCH] Polish serializer for user --- stude/accounts/serializers.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/stude/accounts/serializers.py b/stude/accounts/serializers.py index 36d3c26..4f3d2d4 100644 --- a/stude/accounts/serializers.py +++ b/stude/accounts/serializers.py @@ -21,14 +21,6 @@ class UserRegistrationSerializer(BaseUserRegistrationSerializer): 'student_id_number', 'year_level', 'semester', 'avatar', 'first_name', 'last_name') def create(self, validated_data): - # Extract the necessary fields from validated_data - username = validated_data['username'] - email = validated_data['email'] - password = validated_data['password'] - student_id_number = validated_data['student_id_number'] - first_name = validated_data['first_name'] - last_name = validated_data['last_name'] - # Get the user's year_level and semester from the user model instance user = self.Meta.model(**validated_data) year_level = user.year_level @@ -38,7 +30,7 @@ class UserRegistrationSerializer(BaseUserRegistrationSerializer): user = super().create(validated_data) # Create a student_status object for the user - student_status = StudentStatus.objects.create( + StudentStatus.objects.create( user=user, year_level=year_level, semester=semester,