-1
I want to send text to a view through the template. I have two different types of clients that will be processed differently, to take advantage of code I put in one view and the specific part I treated with a if else
.
In the template:
<a href="{% url 'cliente' 'prime' %}"> Cliente prime </a>
<a href="{% url 'cliente' 'free' %}"> Cliente </a>
In the urls.py
....
path('cliente/<str:tipo>', Cliente, name='cliente'),
.....
In view:
def Cliente(request, tipo):
...
if tipo == "prime":
...
else:
....
Yet I get the following error:
NoReverseMatch at /
Reverse for 'cliente' with no arguments not found. 1 pattern(s) tried: ['cliente\\/(?P<tipo>[^/]+)$']
Apparently you are not passing the text as a parameter I entered in the url.
In this sense, how can I pass a text from the template via url?