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,self)save(*args)
>
>         def cast(self) :
>             return
> self.final_type.get_object_for_this_type(id=self.id)
>
>     class DerivedClass(ParentClass) :
>         pass

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 the parent class content type).

Carl
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to