<reponame>papeclem/Rifa-public
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from .models import Category, Product


class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ['url', 'username', 'email', 'groups']


class GroupSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Group
        fields = ['url', 'name']


class CategorySerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Category
        fields = ['category_id', 'is_leaf', 'category_name']


class ProductSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Product
        fields = ['product_id', 'title', 'ean', 'category_name', 'brand', 'page', 'images', 'scoringdate',
                  'scoringlink', 'scoringsource', 'scoringimg', 'sku', 'fk_id_category', 'score']
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from .models import Category, Product


class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ['url', 'username', 'email', 'groups']


class GroupSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Group
        fields = ['url', 'name']


class CategorySerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Category
        fields = ['category_id', 'is_leaf', 'category_name']


class ProductSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Product
        fields = ['product_id', 'title', 'ean', 'category_name', 'brand', 'page', 'images', 'scoringdate',
                  'scoringlink', 'scoringsource', 'scoringimg', 'sku', 'fk_id_category', 'score']