Serializer is hard code and isn't using UPDATE_ON_DUPLICATE_REG_ID setting
linhnvhicts opened this issue · 1 comments
linhnvhicts commented
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"])
linhnvhicts commented
it was a mistake, sorry i forgot to put the setting in PUSH_NOTIFICATIONS_SETTINGS