Django pass object to include
I cannot do the following in Django:
{% include "admin/includes/pager.html" with title_pager="{{myobject.title}}" %}
or
{% include "admin/includes/pager.html" with title_pager="{{myobject}}" %}
What is the workaround?
You do not need to surround arguments in {{ }}
brackets in template tags.
If it's a variable, not a string, then do not use ""
quotes.
The following should work:
{% include "admin/includes/pager.html" with title_pager=myobject.title %}
{% include "admin/includes/pager.html" with title_pager=myobject %}
See the Django docs for the include tag for more information.