def validate_registration_id(self, value): # iOS device tokens are 256-bit hexadecimal (64 characters) if hex_re.match(value) is None or len(value) != 64: raise ValidationError("Registration ID (device token) is invalid") return value
def validate_registration_id(self, value): # iOS device tokens are 256-bit hexadecimal (64 characters). In 2016 Apple is increasing # iOS device tokens to 100 bytes hexadecimal (200 characters). if hex_re.match(value) is None or len(value) not in (64, 200): raise ValidationError("Registration ID (device token) is invalid") return value
def validate_registration_id(self, value, source): if hex_re.match(value[source]) is None or len(value[source]) != 64: raise ValidationError("Registration ID (device token) is invalid") return value