-
Notifications
You must be signed in to change notification settings - Fork 230
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
Try to invalidate m2m in more robust way #94
Conversation
First, multitable inheritance is not supported at all, it's stated in README, see CAVEATS, 8. Also, take a look at #31 and these expected failures. Your patch won't fix that. Regarding m2m invalidation for explicit through models, it works. Regular |
Please rebase so that there are no merge commits. Also note that there is no |
Hi! Sure, I'll do it tomorrow.
|
Rebased. Please check. |
@@ -536,19 +536,24 @@ def invalidate_m2m(sender=None, instance=None, model=None, action=None, pk_set=N | |||
if not sender._meta.auto_created: | |||
return | |||
|
|||
for m2m in instance._meta.many_to_many: | |||
if (m2m.rel.through == sender | |||
and m2m.rel.to == model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any point in second check? I think it's impossible to use single through model for several m2ms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so too, but I`m not sure. I can eliminate it if you wish.
Try to invalidate m2m in more robust way
Hi!
I faced with bug when m2m is used with multi-table inheritance model. But I think that similar bug can occur, when the handmade
through
-model is used in m2m relation (i.e. through-model field names are not correspond to the names of related models)The changes contain fix for such cases. Tests are included. Please review these.
Thanks!