Traversing Foreign Key Related Tables In Django Templates
View categories = Category.objects.all() t = loader.get_template('index.html') v = Context({ 'categories': categories }) return HttpResponse(t.render(v)) Template {% for categ
Solution 1:
Just get rid of the parentheses:
{% for company in category.company_set.all %}
Here's the appropriate documentation. You can call methods that take 0 parameters this way.
Post a Comment for "Traversing Foreign Key Related Tables In Django Templates"