Reputation: 13
Hey i have a problem with defining a variable in Django templates. I don´t know hat im doing wrong.
{% set name="World" %}
<html>
<div>Hello {{name}}!</div>
</html>
Django Invalid block tag on line 1: 'set'. Did you forget to register or load this tag?
Upvotes: 0
Views: 617
Reputation: 11879
I think you want to be using a "with" rather than "set".
https://docs.djangoproject.com/en/1.11/ref/templates/builtins/#with
{% with name='world'%}
<html>
<div>Hello {{name}}!</div>
</html>
{% endwith %}
Upvotes: 2