开发者

Problem with django templates

开发者 https://www.devze.com 2023-03-12 10:33 出处:网络
Is there any s开发者_如何学Colution to do something like this: {% for c in categories %} {% for s in c.subcategory_set %}

Is there any s开发者_如何学Colution to do something like this:

{% for c in categories %}
   {% for s in c.subcategory_set %}
   <li>{{ s.name }}</li>
   {% endfor %}
{% endfor %}

???


Reverse relations on a FK have a manager. As such, you need to use the all() method if you want to access all related objects.

{% for s in c.subcategory_set.all %}
0

精彩评论

暂无评论...
验证码 换一张
取 消