Chitrank-Dixit / django-fcm

Django FCM provides firebase cloud messaging to android or ios support for django apps
https://django-fcm.readthedocs.io/en/latest/
MIT License
54 stars 28 forks source link

Extending Device Model produces error on Registration #27

Open renzosunico opened 7 years ago

renzosunico commented 7 years ago

I can no longer use the registration url after extending device model since I have a non nullable user field.

Chitrank-Dixit commented 7 years ago

Hello @renzosunico , sorry for very late reply , is this error coming in the new django-fcm 0.1.1 version ?

jwjimmy commented 7 years ago

I have this same issue on 0.1.1. It looks like the root cause is that when you modify the Device model, the fields of the corresponding DeviceSerializer stay the same.

A quick fix would be to make a change in https://github.com/Chitrank-Dixit/django-fcm/blob/master/fcm/serializers.py#L9

fields = ('dev_id', 'reg_id', 'name', 'is_active')

to

fields = '__all__'

and https://github.com/Chitrank-Dixit/django-fcm/blob/master/fcm/admin.py#L14

list_display = ['dev_id', 'name', 'is_active']

to

list_display = [f.name for f in Device._meta.fields if f.name != "id" if f.name != "reg_id"]

I have these changes ready in a PR I will add to this repo if you'd like to add me as a collaborator.