pythondjangoblogscode-snippetszinnia

Explain the code snippet in Django


I am pretty new to Django. I am fiddling with zinnia to customize it and setting it up with my own theme/template etc. The main content displayed in the default template is following:

{% for object in object_list %}
  {% include object.content_template with object_content=object.html_preview continue_reading=1 %}
{% empty %}

I understand that include includes the template inside a page. But what I cannot comprehend is: how do I find the relevant template being rendered? What is content_template? Please help me in understanding this snippet.


Solution

  • The template name (content_template) is being fetched from the database. It is a property of the model ContentTemplateEntry and defaults to zinnia/_entry_detail.html.