[Django]-Django templates: how to concatenate a named URL and a string?

5👍

Just use:

<form method="POST" action="{% url 'main:add' %}whatever/">

The code inside the curly braces will be rendered by your template system, and will precede the whatever, thus generating the following HTML:

<form method="POST" action="/main/add/whatever/">

Leave a comment