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

Linter failing when using django 'through' #218

Closed
ibreschi opened this issue May 25, 2022 · 1 comment · Fixed by #222
Closed

Linter failing when using django 'through' #218

ibreschi opened this issue May 25, 2022 · 1 comment · Fixed by #222
Assignees

Comments

@ibreschi
Copy link

through doc

https://docs.djangoproject.com/en/4.0/ref/models/fields/#django.db.models.ManyToManyField.through

Example code

def forwards_func(apps, schema_editor):
    Question = apps.get_model("solution", "Question")
    ...
    Question.many_to_may.through.objects.bulk_create(...)                 <- this line?
    ...

Example Error

(fs_solution, 0002_my_migration)... ERR (cached)
        'forwards_func': Could not find an 'apps.get_model("...", "through")' call. Importing the model directly is incorrect for data migrations.
@David-Wobrock
Copy link
Collaborator

Hey @ibreschi
Thanks for the report 👍

Nice catch, I'll push a fix for that.

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