from rest_framework import serializers
from book.models import Book,Category

class BookSerializer(serializers.HyperlinkedModelSerializer):
    url =serializers.HyperlinkedIdentityField(
        lookup_field='slug',
        view_name='book-detail'
    )
    class Meta:
        model = Book
        fields =('url','title','author','edition','thumbnail','kindle','language','published','category')
        extra_kwargs = {
            'category': {'lookup_field': 'slug'}
        }

class CategorySerializer(serializers.HyperlinkedModelSerializer):
    url =serializers.HyperlinkedIdentityField(
        lookup_field='slug',
        view_name='category-detail'
    )
    class Meta:
        model = Category
        fields = ('url','name','description','parent')
        extra_kwargs = {
            'parent': {'lookup_field': 'slug'}
        }
class CategorySerializerCreate(serializers.ModelSerializer):
    class Meta:
        model=Category
class BookSerializerCreate(serializers.ModelSerializer):
    class Meta:
        model=Book
        fields='__all__'


9a043554e73f9d60f126fbfc80aaf199911e37c0
<mask token>


class CategorySerializer(serializers.HyperlinkedModelSerializer):
    url = serializers.HyperlinkedIdentityField(lookup_field='slug',
        view_name='category-detail')


    class Meta:
        model = Category
        fields = 'url', 'name', 'description', 'parent'
        extra_kwargs = {'parent': {'lookup_field': 'slug'}}


class CategorySerializerCreate(serializers.ModelSerializer):


    class Meta:
        model = Category


class BookSerializerCreate(serializers.ModelSerializer):


    class Meta:
        model = Book
        fields = '__all__'

<mask token>


class BookSerializer(serializers.HyperlinkedModelSerializer):
    <mask token>


    class Meta:
        model = Book
        fields = ('url', 'title', 'author', 'edition', 'thumbnail',
            'kindle', 'language', 'published', 'category')
        extra_kwargs = {'category': {'lookup_field': 'slug'}}


class CategorySerializer(serializers.HyperlinkedModelSerializer):
    url = serializers.HyperlinkedIdentityField(lookup_field='slug',
        view_name='category-detail')


    class Meta:
        model = Category
        fields = 'url', 'name', 'description', 'parent'
        extra_kwargs = {'parent': {'lookup_field': 'slug'}}


class CategorySerializerCreate(serializers.ModelSerializer):


    class Meta:
        model = Category


class BookSerializerCreate(serializers.ModelSerializer):


    class Meta:
        model = Book
        fields = '__all__'

<mask token>


class BookSerializer(serializers.HyperlinkedModelSerializer):
    url = serializers.HyperlinkedIdentityField(lookup_field='slug',
        view_name='book-detail')


    class Meta:
        model = Book
        fields = ('url', 'title', 'author', 'edition', 'thumbnail',
            'kindle', 'language', 'published', 'category')
        extra_kwargs = {'category': {'lookup_field': 'slug'}}


class CategorySerializer(serializers.HyperlinkedModelSerializer):
    url = serializers.HyperlinkedIdentityField(lookup_field='slug',
        view_name='category-detail')


    class Meta:
        model = Category
        fields = 'url', 'name', 'description', 'parent'
        extra_kwargs = {'parent': {'lookup_field': 'slug'}}


class CategorySerializerCreate(serializers.ModelSerializer):


    class Meta:
        model = Category


class BookSerializerCreate(serializers.ModelSerializer):


    class Meta:
        model = Book
        fields = '__all__'

from rest_framework import serializers
from book.models import Book, Category


class BookSerializer(serializers.HyperlinkedModelSerializer):
    url = serializers.HyperlinkedIdentityField(lookup_field='slug',
        view_name='book-detail')


    class Meta:
        model = Book
        fields = ('url', 'title', 'author', 'edition', 'thumbnail',
            'kindle', 'language', 'published', 'category')
        extra_kwargs = {'category': {'lookup_field': 'slug'}}


class CategorySerializer(serializers.HyperlinkedModelSerializer):
    url = serializers.HyperlinkedIdentityField(lookup_field='slug',
        view_name='category-detail')


    class Meta:
        model = Category
        fields = 'url', 'name', 'description', 'parent'
        extra_kwargs = {'parent': {'lookup_field': 'slug'}}


class CategorySerializerCreate(serializers.ModelSerializer):


    class Meta:
        model = Category


class BookSerializerCreate(serializers.ModelSerializer):


    class Meta:
        model = Book
        fields = '__all__'

from rest_framework import serializers
from book.models import Book,Category

class BookSerializer(serializers.HyperlinkedModelSerializer):
    url =serializers.HyperlinkedIdentityField(
        lookup_field='slug',
        view_name='book-detail'
    )
    class Meta:
        model = Book
        fields =('url','title','author','edition','thumbnail','kindle','language','published','category')
        extra_kwargs = {
            'category': {'lookup_field': 'slug'}
        }

class CategorySerializer(serializers.HyperlinkedModelSerializer):
    url =serializers.HyperlinkedIdentityField(
        lookup_field='slug',
        view_name='category-detail'
    )
    class Meta:
        model = Category
        fields = ('url','name','description','parent')
        extra_kwargs = {
            'parent': {'lookup_field': 'slug'}
        }
class CategorySerializerCreate(serializers.ModelSerializer):
    class Meta:
        model=Category
class BookSerializerCreate(serializers.ModelSerializer):
    class Meta:
        model=Book
        fields='__all__'

