This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.text import gettext_lazy as _ | |
from rest_framework import serializers | |
from rest_framework_simplejwt.tokens import RefreshToken, TokenError | |
class RefreshTokenSerializer(serializers.Serializer): | |
refresh = serializers.CharField() | |
default_error_messages = { | |
'bad_token': _('Token is invalid or expired') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import ssl | |
import json | |
import struct | |
import binascii | |
# device token returned when the iPhone application | |
# registers to receive alerts | |
device_token = b'XXXX ... XXX' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Validator(object): | |
""" | |
Validator for validate data, | |
which used for both rest framework serializers and django forms. | |
Support binding error message for several fields | |
if you override default error fields and set value as tuple. | |
""" | |
default_error_messages = { |