Monday, July 11, 2011

get all objects that are related to current, reverse look up

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

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate