Ejemplo n.º 1
0
def my_jwt_response_handler(token, user=None, request=None):
    return {
        'token': token,
        'user': UserSerializer(user, context={
            'request': request
        }).data
    }
Ejemplo n.º 2
0
class AddressSerializer(serializers.ModelSerializer):
    user = UserSerializer()

    class Meta:
        model = Address
        # fields = ('id', 'user', 'first_name', 'last_name', 'email', 'street_address', 'apartment_address', 'zip', 'city', 'default')
        fields = '__all__'
Ejemplo n.º 3
0
class ArtistSerializer(serializers.ModelSerializer):
    """Сериализация артиста"""
    user = UserSerializer()

    class Meta:
        model = ArtistModel
        fields = ('id', 'user', 'name', 'location', 'bio', 'website', 'logo')
Ejemplo n.º 4
0
class ArtistSerializer(serializers.ModelSerializer):
    """Сериализация артиста"""
    user = UserSerializer()
    image = serializers.SerializerMethodField()

    class Meta:
        model = Artist
        fields = ('id', 'user', 'name', 'location', 'bio', 'website', 'image')

    def get_image(self, artist):
        request = self.context.get('request')
        image_url = artist.image.first().file.url
        return request.build_absolute_uri(image_url)
Ejemplo n.º 5
0
def registeruser(request):
    data = request.data
    userserializer = UserSerializer()
Ejemplo n.º 6
0
class OrderOwnerSerializer(serializers.ModelSerializer):
    owner = UserSerializer()

    class Meta:
        model = Orders
        fields = ('owner', )