Python Forum
how to create dynamic arguments to be passed in jinja template in url_for function?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to create dynamic arguments to be passed in jinja template in url_for function?
I am creating an online player and here I have a search box which returns songs from a databases that matches the search string searched . Each line is clickable and each contains info about the artist name, album name, and song name.

What I want to do now is, that after clicking it will redirect me to specific url like this .../artistname/albumname/titlename where artistname albumname titlename will be different based on what was clicked. So if i click the first one it should be steveroach/possibleplanet/firstmurmer second should be steveroach/possibleplanet/cellmemory etc..

But i dont now how to create these dynamic arguments to be passed in jinja template in url_for function. Do I need to use some sort of javascript or is there any pure flask way which i should know about? I believe this should be pretty straightofroward ..Here is the code in themplate
post code on forum using code tags

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Accessing a value of a dictionary with jinja.... SpongeB0B 2 952 Aug-06-2021, 09:05 AM
Last Post: ndc85430
  how to pass javascript variables to url_for function in a flask template experimental 5 3,566 Oct-29-2020, 03:29 AM
Last Post: universe
  Jinja sort values from request.form SpongeB0B 2 916 Jul-26-2020, 07:41 AM
Last Post: SpongeB0B
  Flask Create global response function to be called from every where in the web app umen 2 1,114 Apr-14-2020, 09:54 PM
Last Post: umen
  Problem with arguments in route function. darktitan 2 1,410 Aug-26-2019, 04:55 PM
Last Post: snippsat
  Flask tutorial errors in jinja, auth undefined Ecniv 2 1,302 May-03-2019, 02:04 PM
Last Post: Ecniv
  flask sqlite jinja accessing and updating database help pascale 5 2,207 Feb-11-2019, 03:49 PM
Last Post: pascale
  display multiple sensors on webpage python flask jinja pascale 6 3,115 Jan-29-2019, 10:10 AM
Last Post: pascale
  How to create dynamic webscraper in Django using BeautifulSoup Prince_Bhatia 1 4,899 Jan-26-2018, 02:07 PM
Last Post: frostbite

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020