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

AttributeError attempting to flush m2m cache #377

Open
sirdodger opened this issue Aug 18, 2020 · 1 comment
Open

AttributeError attempting to flush m2m cache #377

sirdodger opened this issue Aug 18, 2020 · 1 comment

Comments

@sirdodger
Copy link

I am running a Django 2.2.11 (but I also tested with 2.2.15) installation with django-waffle 1.0.0, and I am getting a failure in the m2m signal. As far as I can tell from the docs, that should be allowed?

File "/usr/local/lib/python3.5/dist-packages/waffle/signals.py", line 11, in flag_membership_changed
    instance.flush()
AttributeError: 'User' object has no attribute 'flush'

I can replicate it with a clean installation.

@k4rl85
Copy link
Contributor

k4rl85 commented Jan 14, 2021

I bumped on the same issue.
After some digging i found a problem in the signal receiver flag_membership_changed.

This issue is caused by how m2m_changed retrieve the instance. The code except to receive always an instance of model Flag but this is not guarantee from m2m_changed signal.

More info here
https://docs.djangoproject.com/en/dev/ref/signals/#m2m-changed

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