class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('email', 'first_name', 'last_name')
def to_representation(self, instance):
representation = super().to_representation(instance)
if instance.is_superuser:
representation['admin'] = True
return representation