The base classes allows to implement @register.simple_tag, @register.inclusion_tag and @register.assignment_tag like functionalities,
while still leaving room to extend the parsing, rendering or syntax validation.
For example, not all arguments need to be seen as template variables, filters or literal keywords.

Installation

First install the module, preferably in a virtual environment. It can be installed from PyPI:

pip install django-tag-parser

Or the current folder can be installed:

pip install .

Examples

At the top of your template tags library, always include the standard
Django register variable and our template_tag decorator:

The get_template_name() method can be overwritten too to support dynamic resolving of template names.
By default it checks the template tag_kwarg, and template_name attribute.
Note the template nodes are cached afterwards, it’s not possible to return random templates at each call.

Assignment tags

To create assignment tags that can either render itself, or return context data: