Hi harold,
On Oct 23, 9:27 am, dadapapa <[EMAIL PROTECTED]> wrote:
> If by "save a derived object from a parent instance" you mean that
> the method that saves the object is defined in the parent class,
> than this should not cause a problem, since type(self) will
> dynamically identify the objec
On Oct 19, 10:10 pm, Carl Meyer <[EMAIL PROTECTED]> wrote:
> Just ran into this issue myself (first time using non-abstract
> inheritance). The catch with this recipe is that you can never save a
> derived object from a parent instance, or you break the final_type
> field (it will then contain th
On Sep 12, 2:57 pm, dadapapa <[EMAIL PROTECTED]> wrote:
> class BaseClass(models.Model) :
> final_type = models.ForeignKey(ContentType)
>
> def save(self,*args) :
> self.final_type =
> ContentType.objects.get_for_model(type(self))
> super(BaseClass,sel
Hi Malcolm,
Malcolm Tredinnick wrote:
> > class BaseClass(models.Model) :
> > final_type = models.ForeignKey(ContentType)
> >
> > def save(self,*args) :
>
> For absolute robustness, you should also accept **kwargs here. There are
> a couple of places in Django's code that will
On Fri, 2008-09-12 at 11:57 -0700, dadapapa wrote:
> > It does not work at all. For some reason, final_type also gets
> > upcasted to MediaObject?!
>
> I found the solution, now. The problem was that the __init__ method of
> a Model is also called when objects are restored from the database. So
> It does not work at all. For some reason, final_type also gets
> upcasted to MediaObject?!
I found the solution, now. The problem was that the __init__ method of
a Model is also called when objects are restored from the database. So
when the base class gets initialized by the QueryManager, it
o
6 matches
Mail list logo