[Django] #28978: Djano m2m changed signal model argument is acting wierd

4 views
Skip to first unread message

Django

unread,
Jan 2, 2018, 2:48:09 AM1/2/18
to django-...@googlegroups.com
#28978: Djano m2m changed signal model argument is acting wierd
-------------------------------------+-------------------------------------
Reporter: Dev | Owner: nobody
Aggarwal |
Type: | Status: new
Uncategorized |
Component: Database | Version: 2.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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?

--
Ticket URL: <https://code.djangoproject.com/ticket/28978>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 2, 2018, 2:48:53 AM1/2/18
to django-...@googlegroups.com
#28978: Djano m2m_changed signal's "model" argument is acting wierd
-------------------------------------+-------------------------------------
Reporter: Dev Aggarwal | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/28978#comment:1>

Django

unread,
Jan 2, 2018, 8:16:34 AM1/2/18
to django-...@googlegroups.com
#28978: m2m_changed signal's "model" argument is acting wierd
-------------------------------------+-------------------------------------

Reporter: Dev Aggarwal | Owner: nobody
Type: Uncategorized | Status: closed

Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ramiro Morales):

* status: new => closed
* resolution: => needsinfo


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/28978#comment:2>

Django

unread,
Jan 2, 2018, 9:37:05 AM1/2/18
to django-...@googlegroups.com
#28978: m2m_changed signal's "model" argument is acting wierd
-------------------------------------+-------------------------------------

Reporter: Dev Aggarwal | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Dev Aggarwal):

Replying to [comment:2 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

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28978#comment:3>

Django

unread,
Jan 2, 2018, 9:37:59 AM1/2/18
to django-...@googlegroups.com
#28978: m2m_changed signal's "model" argument is acting wierd
-------------------------------------+-------------------------------------

Reporter: Dev Aggarwal | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Dev Aggarwal):

* resolution: needsinfo => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/28978#comment:4>

Django

unread,
Jan 2, 2018, 9:48:16 AM1/2/18
to django-...@googlegroups.com
#28978: m2m_changed signal's "model" argument is acting wierd
-------------------------------------+-------------------------------------

Reporter: Dev Aggarwal | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* resolution: fixed => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/28978#comment:5>

Reply all
Reply to author
Forward
0 new messages