kopia lustrzana https://github.com/wagtail/wagtail
Reduce number of queries in blog_page (#9857)
rodzic
99eaef6ee6
commit
fb4837371f
|
@ -679,6 +679,7 @@ Contributors
|
||||||
* Vallabh Tiwari
|
* Vallabh Tiwari
|
||||||
* dr-rompecabezas
|
* dr-rompecabezas
|
||||||
* Rishabh jain
|
* Rishabh jain
|
||||||
|
* Jhonatan Lopes
|
||||||
|
|
||||||
Translators
|
Translators
|
||||||
===========
|
===========
|
||||||
|
|
|
@ -694,14 +694,16 @@ Edit one of your `BlogPage` instances, and you should now be able to tag posts:
|
||||||
To render tags on a `BlogPage`, add this to `blog_page.html`:
|
To render tags on a `BlogPage`, add this to `blog_page.html`:
|
||||||
|
|
||||||
```html+django
|
```html+django
|
||||||
{% if page.tags.all.count %}
|
{% with tags=page.tags.all %}
|
||||||
<div class="tags">
|
{% if tags %}
|
||||||
<h3>Tags</h3>
|
<div class="tags">
|
||||||
{% for tag in page.tags.all %}
|
<h3>Tags</h3>
|
||||||
<a href="{% slugurl 'tags' %}?tag={{ tag }}"><button type="button">{{ tag }}</button></a>
|
{% for tag in tags %}
|
||||||
{% endfor %}
|
<a href="{% slugurl 'tags' %}?tag={{ tag }}"><button type="button">{{ tag }}</button></a>
|
||||||
</div>
|
{% endfor %}
|
||||||
{% endif %}
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
```
|
```
|
||||||
|
|
||||||
Notice that we're linking to pages here with the builtin `slugurl`
|
Notice that we're linking to pages here with the builtin `slugurl`
|
||||||
|
|
Ładowanie…
Reference in New Issue