Adding read-only to a lot of fields of the users serializer

remotes/origin/enhancement/email-actions
Jesús Espino 2014-07-30 15:51:38 +02:00
parent e163282351
commit c2b43b1fa1
1 changed files with 5 additions and 3 deletions

View File

@ -29,9 +29,11 @@ class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'full_name', 'full_name_display', 'email', 'github_id',
'color', 'bio', 'default_language', 'default_timezone',
'is_active', 'photo', 'big_photo')
fields = ('id', 'username', 'full_name', 'full_name_display', 'email',
'github_id', 'color', 'bio', 'default_language',
'default_timezone', 'is_active', 'photo', 'big_photo')
read_only_fields = ('id', 'username', 'full_name_display', 'email',
'github_id', 'big_photo')
def get_full_name_display(self, obj):
return obj.get_full_name() if obj else ""