Add a "global" option for the {% definevar %} template tag.

Review Request #10953 — Created March 13, 2020 and submitted — Latest diff uploaded

Information

Djblets
release-2.0.x

Reviewers

This adds a new option to {% definevar %} that allows a variable to be
registered in the top-most template context, ensuring the variable
survives past the current scope. This is useful for defining something
within a template that's intended for use in several distinct blocks,
such as a unique ID or URL that has to be referenced in several places.

It's recommended that consumers have a standard block in a base template
defined before any other blocks or logic that is reserved for global
variable definitions, in order to ensure that these variables are
defined before they're used.

Unit tests passed.

Successfully used this with some upcoming work in Review Board.

Commits

Files

    Loading...