#28978 closed Uncategorized (invalid)
m2m_changed signal's "model" argument is acting wierd
Reported by: | Dev Aggarwal | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 2.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I hace a signal for m2m changed defined like this
@receiver(signals.m2m_changed, sender=models.Exam.questions.through) def exam_questions_change(sender, instance, action, reverse, model, pk_set, using, **kwargs): print(repr(model)) print(model.___class___) print(isinstance(model, models.Question))
And it gives me the following output
<class 'App.models.Question'> <class 'django.db.models.base.ModelBase'> False
What is going on here?
Change History (4)
comment:1 by , 7 years ago
Summary: | Djano m2m changed signal model argument is acting wierd → Djano m2m_changed signal's "model" argument is acting wierd |
---|
follow-up: 3 comment:2 by , 7 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Summary: | Djano m2m_changed signal's "model" argument is acting wierd → m2m_changed signal's "model" argument is acting wierd |
comment:3 by , 7 years ago
Replying to Ramiro Morales:
We'll need more information to tell if there is some Django issue worth investigating here:
What do you expect to see in that model parameter?
And a description of the M2M model setup would be great. Bonus points if you can provide a minimal project showing the issue.
Thanks for the reply.
I figured out what the problem was. I thought that model was an instance but it was the actual class of my model
doing this produced the required behavior :)
>> model == models.Question True
comment:5 by , 7 years ago
Resolution: | needsinfo → invalid |
---|
We'll need more information to tell if there is some Django issue worth investigating here:
What do you expect to see in that model parameter?
And a description of the M2M model setup would be great. Bonus points if you can provide a minimal project showing the issue.