[Answered ]-Template for model โ€“ Django

2๐Ÿ‘

โœ…

You can create template with list of businesses and include it everywhere:

inc/business_list.html

<ul>
{% for object in object_list %}
    <li>{{ object }}</li>
{% endfor %}
</ul>

search_list.html

...
{% include "inc/business_list.html" with object_list=search_list %}
...
๐Ÿ‘คSan4ez

0๐Ÿ‘

Yep, you can include templates within other templates

Snippet

<ul>
    <li>...</li>
</ul>

Template

<html>
{% include "snippet.html" %}
</html>

https://docs.djangoproject.com/en/dev/ref/templates/builtins/#include

๐Ÿ‘คTimmy O'Mahony

Leave a comment