legacy/pairent_backend/pairent_app/serializer.py

48 lines
1.2 KiB
Python
Raw Normal View History

2023-05-01 12:39:34 +02:00
from rest_framework import serializers
2023-05-16 19:02:17 +02:00
<<<<<<< HEAD
2023-05-16 19:00:45 +02:00
from .models import Apartament, User, PsychTestAnswers
2023-05-16 19:02:17 +02:00
=======
2023-05-16 17:08:04 +02:00
from .models import Apartament, User, AuthToken
2023-05-16 19:02:17 +02:00
>>>>>>> 4f5f817d835f6a53448e7d60bb7591c24c825e96
2023-05-01 12:39:34 +02:00
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
2023-05-15 05:12:05 +02:00
fields = ("psych_test_result",)
2023-05-15 06:54:30 +02:00
class PublicUserSerializer(serializers.ModelSerializer):
2023-05-15 05:12:05 +02:00
class Meta:
model = User
2023-05-16 19:00:45 +02:00
exclude = ('favorites_apartments', 'comparison_apartments')
class PsychTestReultsSerializer(serializers.ModelSerializer):
class Meta:
model = PsychTestAnswers
fields = "__all__"
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
2023-05-16 19:02:17 +02:00
fields = "__all__"
2023-05-16 17:08:04 +02:00
class TokenSerializer(serializers.ModelSerializer):
class Meta:
model = AuthToken
2023-05-16 19:02:17 +02:00
fields = '__all__'