#9318: "Virtual" behaviour for signal dispatcher and model inheritance
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  jdunck
  svetlyak40wt                       |         Status:  assigned
                   Type:  New        |      Component:  Core (Other)
  feature                            |       Severity:  Normal
              Milestone:  1.3        |       Keywords:  model inheritance,
                Version:  1.0        |  signals, dispatch, proxy, subclass
             Resolution:             |      Has patch:  1
           Triage Stage:  Accepted   |    Needs tests:  0
    Needs documentation:  0          |  Easy pickings:  0
Patch needs improvement:  1          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
Changes (by erick.yellott@…):

 * ui_ux:   => 0
 * easy:   => 0


Comment:

 The example towards the top with Parent and Child looks like it uses
 Concrete Table Inheritance. Does this work for Single Table inheritance?
 I'm coming from a symfony1.4 and Propel1.6 background and just switched to
 Django1.3 within the week, so maybe I'm just doing it wrong, but for my
 models that inherit an abstract class the signal isn't bubbling up to the
 parent class.

 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!python
 from django.db import models
 from django.db.models.signals import pre_save

 class BaseQBObject(models.Model):

     class Meta:
         abstract = True

     def __unicode__(self):
         if hasattr(self, 'fullname'):
             return self.fullname


 def callback(sender, *args, **kwargs):
     print 'HERE'

 pre_save.connect(callback, sender=BaseQBObject)


 class Account(BaseQBObject):
   # Stuff

   }}}
 }}}


 I would expect saving the child class would print 'HERE', but specifying
 sender=BaseQBObject doesn't seem to work as I would expect.

 Sorry if I'm posting this in the wrong place.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to