Op 12-jul-2011, om 09:18 heeft bruno desthuilliers het volgende geschreven:
> On Jul 12, 4:32 am, garagefan <monkeygar...@gmail.com> wrote: >> simply put, here's my code >> >> class ContentBlock(Orderable, Displayable): >> location = models.ManyToManyField(ContentBlockLocation, blank=True, >> null=True, help_text="list of locations to display content block") >> page = models.ManyToManyField(Page, blank=True, null=True, >> help_text="list of pages to display content block") >> height = models.IntegerField(blank=True, null=True) >> width = models.IntegerField(blank=True, null=True) >> >> def __unicode__(self): >> return self.title >> >> class StaticContent(Displayable, RichText): >> content_block = models.ForeignKey(ContentBlock, blank=True, >> null=True) >> >> class StaticContent2(Displayable, RichText): >> content_block = models.ForeignKey(ContentBlock, blank=True, >> null=True) >> >> putting together a template tag that will return all the items >> associated with a given ContentBlock, but i would like to do so >> without knowing upfront all of the classes that have a foreign key to >> ContentBlock as i'll want to be able to add more content types at any >> time > > > Are you sure your data model is right ? > Displayable and RichText are probably classes that inherit from django.db.models.Model. -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.