USER_MODEL configuration in FCM_DJANGO_SETTINGS not working
phongng-it opened this issue · 5 comments
what do you mean? this looks like the normal way to configure a foreign key to the user model.
Could you define "not working"? You're not supposed to configure the user model for fcm django in the fcm django settings as the library user, you're supposed to use django settings to configure your default user model, which will in turn be picked up by fcm-django.
@xtrinch I configured FCM_DJANGO_SETTINGS as follows:
**FCM_DJANGO_SETTINGS = {
'ONE_DEVICE_PER_USER': True,
'DELETE_INACTIVE_DEVICES': True,
'USER_MODEL': 'users.User'
}**
Then I run the migrate command: python manage.py migrate
When I checked table fcm_django_fcmdevice
, I saw that the user_id field is not linked to the users.User
model.
Please check again. I see the migration file does not work with the USER_MODEL
config
The user model setting is a global django setting, there is no user model setting of fcm-django, as mentioned above in my previous comment.
I suggest you read https://docs.djangoproject.com/en/4.2/topics/auth/customizing/ thorougly. The setting is called AUTH_USER_MODEL
@xtrinch I read your source code, and I see that the user
field is receiving config from the USER_MODEL
config, but migrations are receiving config from the AUTH_USER_MODEL
config, I find this problem very risky. (The USER_MODEL
configuration is taken from the FCM_DJANGO_SETTINGS
settings and the user can change it). I think you should reopen this issue.