serializers.py 399 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
from __future__ import absolute_import

from rest_framework.serializers import ModelSerializer

from pushnotifications.models import Device


class DeviceSerializer(ModelSerializer):
    class Meta:
        model = Device

        fields = ('pk', 'registration_id', 'active', 'date_created', 'type')
        read_only_fields = ('date_created',)

        extra_kwargs = {'active': {'default': True}}