About Multiline Template Tags

By default, Django doesn't support multiline template tags, such as:

{% include
  "components/card.html" with
  title=post.title
  link_url=post.get_url_path
  description=post.description
%}

To allow that for better readability, monkey patch the tags_re in your Django settings or ready() method of a Django app configuration:

import re
from django.template import base

# Force Django's template engine regex to match across newlines
base.tag_re = re.compile(base.tag_re.pattern, re.DOTALL)

Tips and Tricks Programming Django 6.x Django 5.2 Django 4.2