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

Missing migrations? #29

Open rhblind opened 7 years ago

rhblind commented 7 years ago

When using a custom Device model ie. like the one below, makemigrations want to create migrations for the original model.

class FCMDevice(AbstractDevice):
    """
    Firebase Cloud messaging devices
    """
    user = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True)

    class Meta:
        verbose_name = _("FCM Device")
        verbose_name_plural = _("FCM Devices")
$ python manage.py makemigrations
Migrations for 'fcm':
  /Users/rolf/.virtualenvs/someproject/lib/python3.5/site-packages/fcm/migrations/0002_auto_20161213_1303.py:
    - Change Meta options on device
rhblind commented 7 years ago

It seems like there's a missing migration.

dvkovner commented 7 years ago

(env) C:\Source\hospital>python manage.py makemigrations Migrations for 'fcm': 0002_auto_20161214_1238.py:

AndySun25 commented 7 years ago

I think it's generally not advisable to have meta options on the abstract base model, I've relocated model meta options to the child model in my fork and that solved the issue (no migrations were needed).

EDIT Either that or inherit AbstractDevice's metaclass

class Device(AbstractDevice):
    class Meta(AbstractDevice.Meta):
        swappable = 'FCM_DEVICE_MODEL'