Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a ForeignKey or OneToOneField to a model in this package generates migrations #642

Open
levinotik opened this issue Dec 22, 2021 · 2 comments

Comments

@levinotik
Copy link

This package seems to be fundamentally broken. To recreate the issue, simply create a model with something along the lines of the following:

class MyModel(models.Model):
    device = models.OneToOneField(GCMDevice, related_name='my_model', on_delete=models.CASCADE)

then run

python manage.py makemigrations

The result is that Django tries to generate migrations inside of the django-push-notifications package. The only side which should generate migrations is the model with the concrete field, namely MyModel

@simonkern
Copy link
Contributor

simonkern commented Jan 9, 2022

That happens most likely due to the AutoField which can be customized since Django 3.2, see:

https://docs.djangoproject.com/en/4.0/releases/3.2/

https://docs.djangoproject.com/en/4.0/ref/settings/#std:setting-DEFAULT_AUTO_FIELD

Have set the default to BigAutoField in your settings?

If you specify the app you intend to create migrations for, this will no longer be an issue.

@levinotik
Copy link
Author

Hmm, thanks. I'm not on Django 3.2 just yet though and the migrations were generated even when specifying only my app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants