from .models import Item, Snippet
from rest_framework import serializers
from django.contrib.auth.models import User

class UserSerializer(serializers.ModelSerializer):
    owner = serializers.ReadOnlyField(source='owner.username')
    snippets = serializers.PrimaryKeyRelatedField(many=True, queryset=Snippet.objects.all())

    class Meta:
        model = User
        fields = ('id', 'username', 'snippets', 'owner')

class ItemSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Item
        fields = (
        'url', 'item_number', 'name', 'description', 'price',
        'is_new', 'size', 'instructions', 'featured_photo',
        'category')

3724907424289d698eb2bfd733957e9b7f22f1d0
<mask token>


class ItemSerializer(serializers.HyperlinkedModelSerializer):


    class Meta:
        model = Item
        fields = ('url', 'item_number', 'name', 'description', 'price',
            'is_new', 'size', 'instructions', 'featured_photo', 'category')

<mask token>


class UserSerializer(serializers.ModelSerializer):
    <mask token>
    <mask token>


    class Meta:
        model = User
        fields = 'id', 'username', 'snippets', 'owner'


class ItemSerializer(serializers.HyperlinkedModelSerializer):


    class Meta:
        model = Item
        fields = ('url', 'item_number', 'name', 'description', 'price',
            'is_new', 'size', 'instructions', 'featured_photo', 'category')

<mask token>


class UserSerializer(serializers.ModelSerializer):
    owner = serializers.ReadOnlyField(source='owner.username')
    snippets = serializers.PrimaryKeyRelatedField(many=True, queryset=
        Snippet.objects.all())


    class Meta:
        model = User
        fields = 'id', 'username', 'snippets', 'owner'


class ItemSerializer(serializers.HyperlinkedModelSerializer):


    class Meta:
        model = Item
        fields = ('url', 'item_number', 'name', 'description', 'price',
            'is_new', 'size', 'instructions', 'featured_photo', 'category')

from .models import Item, Snippet
from rest_framework import serializers
from django.contrib.auth.models import User


class UserSerializer(serializers.ModelSerializer):
    owner = serializers.ReadOnlyField(source='owner.username')
    snippets = serializers.PrimaryKeyRelatedField(many=True, queryset=
        Snippet.objects.all())


    class Meta:
        model = User
        fields = 'id', 'username', 'snippets', 'owner'


class ItemSerializer(serializers.HyperlinkedModelSerializer):


    class Meta:
        model = Item
        fields = ('url', 'item_number', 'name', 'description', 'price',
            'is_new', 'size', 'instructions', 'featured_photo', 'category')

from .models import Item, Snippet
from rest_framework import serializers
from django.contrib.auth.models import User

class UserSerializer(serializers.ModelSerializer):
    owner = serializers.ReadOnlyField(source='owner.username')
    snippets = serializers.PrimaryKeyRelatedField(many=True, queryset=Snippet.objects.all())

    class Meta:
        model = User
        fields = ('id', 'username', 'snippets', 'owner')

class ItemSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Item
        fields = (
        'url', 'item_number', 'name', 'description', 'price',
        'is_new', 'size', 'instructions', 'featured_photo',
        'category')
