I am building an address book that includes the relationships between entries, etc. I have separate models for Individuals, Companies, Venues, and Roles. On my index page I
If you want to build it on Django 1.5 you will be able to utilize stable version of CBVs. Please find code below.
Great doc you can find here https://docs.djangoproject.com/en/dev/topics/class-based-views/mixins/
class ProductsCategoryList(ListView):
context_object_name = 'products_list'
template_name = 'gallery/index_newborn.html'
def get_queryset(self):
self.category = get_object_or_404(Category, name=self.args[0])
return Products.objects.filter(category=self.category)
def get_context_data(self, **kwargs):
kwargs['category'] = Category.objects.all()
# And so on for more models
return super(ProductsCategoryList, self).get_context_data(**kwargs)