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. Easy Conditional Template Tags by fragsworth 4 years, 10 months ago
  2. ifcontains tag by dotbg 5 years, 2 months ago
  3. Allow template tags in a Flatpage's content by kylefox 5 years, 9 months ago
  4. Forms splitted in fieldsets by gustavo80br 6 years ago
  5. Template tag for stripping blank lines by akaihola 6 years, 2 months ago

Comments

(Forgotten your password?)