django-push-notifications
django-push-notifications copied to clipboard
[Issue] Module saves id of user instead of username
I have a custom user model, however, when i register a device, the fcm-django model registers the id column of the related username or (partner_id in my case) to the user_id column.
I want the user_id column to have username from the users table and not the id of the particular username row
I have attached screenshots of the tables, how can i fix this? I need to send push notifications to a particular username(partner_id) which is my unique identifier for data across other tables.
PS: partner_id == username.
My users table:
django push notifications table:
@uber1geek The user column is a foreign key, the value stored is the id reference to your user table. To get the devices using the partner_id from your user table try:
devices = GCMDevice.objects.filter(user__partner_id='X1234')
@jamaalscarlett Thanks, I didn't think of that before.
I was doing client = User.objects.get(partner_id=self.request.user.username)
and devices = GCMDevice.objects.filter(user_id=client.id)
which worked but the way you suggested looks better.
Thanks :)
@jamaalscarlett How do we decide when the device is inactive? Does it depend on FCM_ERROR_TIMEOUT
? What would be an ideal error timeout in your opinion?
@uber1geek There is an active flag on the device model.