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)
--
Michael <[email protected]>
On Wed, 2010-11-03 at 22:17 +0100, Marc Aymerich wrote:
> Hi,
> I have 2 abstract classes with an overrided save function, class BaseA
> and class BaseB. BaseA trigger the models.Model save function, the
> other doesn't.
>
>
> class BaseA(models.Model):
> class Meta:
> abstract = True
>
>
> def save(self, *args, **kwargs):
> super(BaseA, self).save(*args, **kwargs)
>
>
>
>
> class BaseB(models.Model):
> class Meta:
> abstract = True
>
> def save(self, *args, **kwargs):
> pass
>
>
> Now I define a class that inherits from both of these classes:
>
>
> class test1(BaseA, BaseB):
> integer = models.IntegerField()
>
>
> and when I save a test1 object it is not saved into the database. The
> reason is that BaseB class doesn't call super save function.
> But actually I don't see why this fact entails the object isn't saved,
> because models.Model function is called through BaseA. What is the
> reason of this behavior? What can I do in order to save an object into
> the db when I inherit from multiple class and one of them doesn't call
> the super save function?
>
>
>
>
> Many Thanks!
> --
> 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 django-users
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
--
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.