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

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

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.

Summary ID
Add a "global" option for the {% definevar %} template tag.
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.
1eb6ca7ecbb7ef63745e416126b10922852dfd06
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (f475537)