On Wed, Nov 3, 2010 at 11:50 PM, Michael <[email protected]> wrote:
> nevermind my previous email, I see now you are talking about the test1
> class, which isn't abstract.
>
> In that case I assume the problem is Python's multiple inheritance,
> where the first parent it finds with a save() method gets called, and no
> others. It's probably calling BaseB.save(), which does nothing. If you
> want test1.save to call BaseA.save, you'll have to make that explicit:
>
> class test1(BaseA, BaseB):
> integer = models.IntegerField()
>
> def save(self, *args, **kargs):
> BaseA.save(self, *args, **kargs)
Hi Michael, thanks for your answer :).
I also thought about this and in order to discart it I add another
inheritance level in clase BaseA with a print call, just like this:
class BaseAA(models.Model):
class Meta:
abstract = True
def save(self, *args, **kwargs):
print "Inside save method!!!"
class BaseA(BaseAA):
class Meta:
abstract = True
def save(self, *args, **kwargs):
super(BaseA, self).save(*args, **kwargs)
print "Inside save method!!!" is trigged, so BaseA.save() and
super.(BaseA).save() is also called.
--
Marc
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.