in Contact, the root class:

        def save(self):
               """ on create, save the content type (leaf class) of
this object """
                if(not self.content_type): # does this do a db lookup to
instantiate ?  should try to avoid that
                        self.content_type =
ContentType.objects.get_for_model(self.__class__)
                self.save_base()

        def as_leaf_class(self):
                """if this object is a subclass then refetch it with
the extra fields/table joins"""
                content_type = self.content_type
                model = content_type.model_class()
                if(model == Contact):
                        #actually we could also check if self is not
Contact that throw a shit-out-of-wack error
                        return self
                return model.objects.get(id=self.id)




On Jun 29, 4:09 pm, felix <[EMAIL PROTECTED]> wrote:
>
> > Or you can manually include a type_code attribute in your
> > parent model (since it's something you have created yourself).
>
> yes, I'll try this.
--~--~---------~--~----~------------~-------~--~----~
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