Skip to content

Commit

Permalink
feat: Add favorite field to user model
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirezaYousefpourM committed Sep 7, 2024
1 parent a5532fb commit eb849f0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions user/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ class UserAdminConfig(UserAdmin):
fieldsets = (
(None , {'fields' : ('email','user_name','first_name','password')}),
('permissions' , {'fields' : ('is_staff','is_active')}),
('personal',{'fields':('phone_number','about','profile')}),
('personal',{'fields':('phone_number','about','profile','favorite_game_title')}),
('team' , {'fields':('team' , 'team_role')})
)
add_fieldsets = (
(None , {'fields' : ('email','user_name','first_name','password')}),
('permissions' , {'fields' : ('is_staff','is_active')}),
('personal',{'fields':('phone_number','about','profile')}),
('personal',{'fields':('phone_number','about','profile','favorite_game_title')}),
('team' , {'fields':('team' , 'team_role')})

)
Expand Down
1 change: 1 addition & 0 deletions user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class SiteUser(AbstractBaseUser, PermissionsMixin):
activation_code = models.CharField(max_length=64, blank=True)
team = models.ForeignKey(Team, on_delete=models.SET_NULL, null=True, blank=True, related_name='members')
team_role = models.CharField(choices=TEAM_MEMBER_ROLE, default='NO', max_length=2)
favorite_game_title = models.CharField(max_length=50, blank=True)
# event informations
phone_number = models.CharField(_("phone number"), validators=[PhoneValidator()], max_length=32, blank=False,
null=False)
Expand Down
2 changes: 1 addition & 1 deletion user/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CustomUserSerializer(serializers.ModelSerializer):
class Meta:
model = get_user_model()
fields = ('team_role', 'team', 'email', 'user_name', 'password',
'first_name', 'phone_number', 'profile', 'is_staff')
'first_name', 'phone_number', 'profile', 'is_staff', 'favorite_game_title')
extra_kwargs = {'password': {'write_only': True}}

def create(self, validated_data):
Expand Down

0 comments on commit eb849f0

Please sign in to comment.