On Fri, May 15, 2009 at 9:57 AM, George Song <[email protected]> wrote:
> > On 5/15/2009 8:18 AM, Rusty Greer wrote: > > > > > > I have something like this: > > > > class Class1(models.Model): > > // lots of fields here > > > > class AbstractThing(models.Model): > > // lots of fields here > > class1field = model.ForeignKey(Class1) > > class Meta: > > abstract = True > > > > class ThingType1(AbstractThing): > > // lots of fields here > > > > class ThingType2(AbstractThing): > > // lots of fields here > > > > > > in my template, i want to be able to do something like: > > class1.abstractthing_set.all > > > > but that doesn't seem to work, i seem to have to do: > > class1.thingtype1_set.all and class1.thingtype2_set.all > > > > does this make sense? am i missing something? > > > > any help would be appreciated. > > The pattern you describe should work fine. What exactly isn't working? > > -- > George > > from within the template, class1.abstractthing_set.all returns nothing, class1.thingtype1_set.all returns exactly what is expected from python code, class1.abstractthing_set.all gives me an AttributeError 'class1' object has no attribute 'abstractthing_set' class1.thingtype1_set.all returns exactly what is expected i was hoping that the abstractthing_set would return all of the objects of both thingtype1 and thingtype2 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

