>> I want a page which displays both the details of an object and the list of >> the objects. Really important question: is the object you want the details of related to the list of objects, via a ForeignKey or ManyToManyField? Because if so, you don't need to do any view combination at all. (Of course, if they are unrelated, everything everyone else said about extending generic views is dead on).
One thing that no one here has mentioned, and which the documentation also does a poor job of mentioning (presumably because it explains models before it explains templates, and thus doesn't want to get in to template details when it explains model realtionships) is that if you define relationships between objects, you can access related objects in templates. For instance, let's say you have these models: class UL(models.Model): pass class LI(models.Model): UL = models.ForeignKey(UL) name = models.TextField() Using the object detail generic view on UL will give you an "object" variable in your template for the given UL. This variable will have an attribute (my terminology may be a little off here, but I'm too lazy to look up the correct phrase, so just look at my examples if you're confused): "li_set". This attribute in turn has two attributes: "all", and "count". You can use these attributes to access the related LI's. For instance, using: {{ object.li_set.count }} in your template will return the number of LI objects that have a foreign key of this particular UL object's ID. Similarly, using: {% for li in object.li_set.all %} {{ li.name }} {% endfor %} will return the names of all of the LI's associated with this particular UL object. Hope that helps. Jeremy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---