You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

16 lines
484 B

import os
from rest_framework import serializers
from .models import ReyMotaUser
class ReyMotaUserSerializer(serializers.ModelSerializer):
class Meta:
model = ReyMotaUser
fields = ['email', 'password', 'foto', 'is_superuser', 'is_staff', 'is_active', 'nombre', 'last_login']
def to_representation(self, instance):
ret = super().to_representation(instance)
ret['foto'] = "profile_images/" + os.path.basename(ret['foto'])
return ret