Django Macros

screenshot of Django Macros

macros accepting positional and keyword arguments, and repeated block tags in the django template system.

Overview

django-macros is a package for the Django template system that allows users to create macros with positional and keyword arguments, as well as repeat block tags within a template. It provides a solution for cases where the built-in include tag does not meet the requirements. The macros can be defined within the same template file or in a separate file, and they are local to the file they are defined in and not inherited through extends tags.

Features

  • Macros accepting positional and keyword arguments
  • Repeated block tags within a template
  • Ability to save macros in a separate file and load them into the template
  • Support for inputting template variables into macros
  • Fully inheritable and repeat inherited content within repeated blocks

Summary

django-macros provides a way to create macros with positional and keyword arguments, and repeat block tags within the Django template system. It offers an alternative to the built-in include tag and allows for more flexibility in generating and subbing values in templates. The package is easy to install and use, and it provides a helpful solution for cases where the standard template tags fall short.