legacy/pairent_backend/pairent_app/serializer.py

46 lines
1.2 KiB
Python

from rest_framework import serializers
from .models import Apartament, User, PsychTestAnswers, AuthToken
from .models import Apartament, User, AuthToken
class ApartamentListSerializer(serializers.ModelSerializer):
"""Список всех квартиры"""
class Meta:
model = Apartament
exclude = ("views",)
class ApartamentDetailSerializer(serializers.ModelSerializer):
"""Вывод квартиры"""
class Meta:
model = Apartament
fields = "__all__"
class PsychTestAddResultSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ("psych_test_result",)
class PublicUserSerializer(serializers.ModelSerializer):
class Meta:
model = User
exclude = ('favorites_apartments', 'comparison_apartments')
class PsychTestReultsSerializer(serializers.ModelSerializer):
class Meta:
model = PsychTestAnswers
fields = "__all__"
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = "__all__"
class TokenSerializer(serializers.ModelSerializer):
class Meta:
model = AuthToken
fields = '__all__'