You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some subtle and not-so-subtle variations in the different implementations of Django-style templates. For instance, default values in Django look like this, which is really just a holdover from Smarty:
{{ foo|default:"bar" }}
Whereas Jinja (and Nunjucks, which followed its lead) uses the function-style syntax:
{{ foo|default("bar") }}
I'm inclined to go with the Jinja syntax since Django can be made to work with Jinja templates, but not vice-versa. The goal here isn't necessarily full cross-compatibility of templates between systems, but I'd like to avoid anything proprietary to Nunjucks that would make it difficult to make a move (or at least a port) to Python, for instance, at a later date. It may also be possible to standardize on the form:
{{ foo and foo or "bar" }}
The text was updated successfully, but these errors were encountered:
There are some subtle and not-so-subtle variations in the different implementations of Django-style templates. For instance, default values in Django look like this, which is really just a holdover from Smarty:
Whereas Jinja (and Nunjucks, which followed its lead) uses the function-style syntax:
I'm inclined to go with the Jinja syntax since Django can be made to work with Jinja templates, but not vice-versa. The goal here isn't necessarily full cross-compatibility of templates between systems, but I'd like to avoid anything proprietary to Nunjucks that would make it difficult to make a move (or at least a port) to Python, for instance, at a later date. It may also be possible to standardize on the form:
The text was updated successfully, but these errors were encountered: