1👍
Use add
tag of Django Template Lang:
{% if people_found %}
{% for the_people in people_found %}
<a href="{% url 'Search4Bday:profile' the_people.firstname|add:"/"|add:the_people.id %}">{{the_people.firstname}}</a>
{% endfor %}
{% endif %}
edit: I didn’t pay attention to urls.py and this will not work as wanted. Instead of adding slashes between variables put them directly. So this should work.
{% if people_found %}
{% for the_people in people_found %}
<a href="{% url 'Search4Bday:profile' the_people.firstname the_people.id %}">{{the_people.firstname}}</a>
{% endfor %}
{% endif %}
0👍
I tried another method, I could have just done this:
{% if people_found %}
{% for the_people in people_found %}
<a href="{% url 'Search4Bday:profile' the_people.firstname the_people.id %}">{{the_people.firstname}}</a>
{% endfor %}
{% endif %}
https://docs.djangoproject.com/en/4.0/ref/templates/language/
Source:stackexchange.com