Reputation: 2166
in my html template, under localhost:8000/
, I have some hrefs
:
en en-us gb fr
When a users clicks fr
I want to make the url to be localhost:8000/country=fr
How to do that? thanks
views.py:
langs = Language.objects.all()
return render(request, 'themes_list.html', {'langs': langs})
template:
<h2>Select Language:</h2>
{% for lang in langs %}
<a href=".......">{{ lang.code }}</a>
{% endfor %}
Upvotes: 0
Views: 62
Reputation: 672
When a users clicks fr, you can make the url to
localhost:8000/?country=fr
by writing a html like
<a href="/?country={{lang.code}}">{{ lang.code }}</a>
The Url without question is not possible
localhost:8000/country=fr
Upvotes: 1