I have a model with numerous objects. However, some of these objects have sub-objects and some do not. When calling up an object with sub-objects, (linked by a foreign key) I’d like to display
Object 1. Sub object 2. Sub object And when the user requests an object with no subs, they get Object However, if I have a ‘get’ for objects in my view, I am going to get an error for all objects that have sub objects. Similarly, if I use a listview, I will get all the objects and sub objects on one long page, which I don’t want. My tentative solution is to put this in the template: If objects with sub objects {{List of linked sub objects}} else {{object}} Assuming that works, my difficulty is with the view. How do I write it to cover both situations without putting them in separate models? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/902668f2-22ef-4ba6-a234-dca1128a2e25%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.