Page MenuHomec4science

serializers.py
No OneTemporary

File Metadata

Created
Wed, May 29, 01:15

serializers.py

from rest_framework import serializers
from dj_rql.drf.serializers import RQLMixin
from .models import Journal, Institution, OrganizationCondition, JournalCondition, ConditionSet, Term
class JournalSerializer(RQLMixin,serializers.ModelSerializer):
class Meta:
model = Journal
fields = '__all__'
class InstitSerializer(RQLMixin,serializers.ModelSerializer):
class Meta:
model = Institution
fields = '__all__'
class TermSerializer(RQLMixin,serializers.ModelSerializer):
class Meta:
model = Term
fields = '__all__'
depth = 2
class ConditionSetSerializer(RQLMixin,serializers.ModelSerializer):
term = TermSerializer(many=True, read_only=True)
class Meta:
model = ConditionSet
fields = ['id','condition_type','term']
depth = 2
class OrganizationConditionSerializer(RQLMixin, serializers.ModelSerializer):
condition_set = ConditionSetSerializer(many=False, read_only=True)
class Meta:
model = OrganizationCondition
fields = ['valid_from','valid_until','organization','condition_set']
depth = 5
class JournalConditionSerializer(RQLMixin,serializers.ModelSerializer):
condition_set = ConditionSetSerializer(many=False, read_only=True)
class Meta:
model = JournalCondition
fields = ['valid_from','valid_until','journal','condition_set']
depth = 5

Event Timeline