Thank you Daniel (and James) for your prompt responses. At least now I
know I wasn't missing something obvious. Your comment about storing
the type in each object sparked an idea:

from django.contrib.contenttypes.models import ContentType # very
handy that Django stores this information...
#...
class Item(models.Model): #generic super class
        # [other fields go here]
        content_type = models.ForeignKey(ContentType) # each item should
store its own class/type
        def save(self):
                self.content_type = ContentType.objects.get_for_model(self) # 
when a
decendant object is saved, this correctly stores the subclass type
                super(Item,self).save()
        def render(self):
                subclass =
self.content_type.model_class().objects.get(item_ptr=self.id) # this
returns the object with the correct class/type
                return subclass.render()

#Now if I say, for example:
for i in Item.objects.all():
        i.render()

This works beautifully -- i.render() calls the render method of the
true subclass. Hopefully others might find this helpful also.

Thanks again for your help guys.

--~--~---------~--~----~------------~-------~--~----~
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