Tag Formatters¤
Tag formatters allow you to change the syntax for calling components from within the Django templates.
Tag formatter are set via the tag_formatter setting.
Available tag formatters¤
-
django_components.component_formatterfor ComponentFormatter -
django_components.component_shorthand_formatterfor ShorthandComponentFormatter
ComponentFormatter ¤
Bases: django_components.tag_formatter.TagFormatterABC
The original django_component's component tag formatter, it uses the {% component %} and {% endcomponent %} tags, and the component name is given as the first positional arg.
Example as block:
Example as inlined tag:
ShorthandComponentFormatter ¤
Bases: django_components.tag_formatter.TagFormatterABC
The component tag formatter that uses {% <name> %} / {% end<name> %} tags.
This is similar to django-web-components and django-slippers syntax.
Example as block:
Example as inlined tag: