Source code for pushnotifications.api.serializers
from rest_framework.relations import ManyRelatedField, PrimaryKeyRelatedField
from rest_framework.serializers import ModelSerializer
from pushnotifications.models import Device, Category, Message
[docs]class DeviceSerializer(ModelSerializer):
receive_category = ManyRelatedField(
allow_empty=True,
required=False,
child_relation=PrimaryKeyRelatedField(
allow_empty=True, queryset=Category.objects.all(), required=False
),
)
[docs]class CategorySerializer(ModelSerializer):
[docs]class MessageSerializer(ModelSerializer):