This serializer has hard code to check for duplicate registration_id , so even if i set UPDATE_ON_DUPLICATE_REG_ID in setting the update registration_id on duplicate doesn't work and always return
{
"registration_id": [
"This field must be unique."
]
}
regardless of the setting
a quick fix should be checking if UPDATE_ON_DUPLICATE_REG_ID is set in setting, if it's set then don't check for duplicate device on create
elif request_method == "create" and not settings.UPDATE_ON_DUPLICATE_REG_ID:
devices = Device.objects.filter(registration_id=attrs["registration_id"])
https://github.com/jazzband/django-push-notifications/blob/13a2c6f7b34ab884f65e2791841549975795bebf/push_notifications/api/rest_framework.py#L58
This serializer has hard code to check for duplicate
registration_id
, so even if i setUPDATE_ON_DUPLICATE_REG_ID
in setting the updateregistration_id
on duplicate doesn't work and always returnregardless of the setting
a quick fix should be checking if
UPDATE_ON_DUPLICATE_REG_ID
is set in setting, if it's set then don't check for duplicate device oncreate