I have a function that calls another function and passes a query string to the end of the URL.
How would I accomplish the following --
if my_videos: return render(request, template, {kwargs}) + "?filter=others&sort=newest"
Note: I do not care if I use render or not, its use is merely to point out what I'm trying to accomplish. Thank you.
On the Internet, a querystring (also called an HTTP querystring) is part of the set of characters automatically input in the address bar of a dynamic Web site when a user makes a request for information according to certain criteria.
To pass in parameter values, simply append them to the query string at the end of the base URL. In the above example, the view parameter script name is viewParameter1.
Django URL pass parameter to view You can pass a URL parameter from the URL to a view using a path converter. Then “products” will be the URL endpoint. A path converter defines which type of data will a parameter store. You can compare path converters with data types.
Pass the query string in the template:
<a href="{% url 'my_videos' %}?filter=others&sort=newest">My Videos</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With