inclusion tag with template as variable

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
dummy_extends_template.html 
=========================
{% extends template %}


template_tag_code.py
===============================
from django.template import Template, Library

register = Library()

# you can use {% include template %} to

...

@register.inclusion_tag("dummy_extends_template.html" )
def my_template_tag(template, arg1, arg2, arg3):
    """ template can be Template object or template name """
    ... 
    return {'template':template, 'arg1':arg1, 'arg2':arg2 }

More like this

  1. Private Context Decorator by acdha 2 years, 5 months ago
  2. Filter by first letter inclusion tag by slafs 1 year, 8 months ago
  3. render_partial by hachaboob 3 years, 5 months ago
  4. Decorate Template Tag (In-Line include and extend with local context) by rhomber 2 years, 1 month ago
  5. Template context debugger with (I)Pdb by denis 2 years, 8 months ago

Comments

(Forgotten your password?)