Skip to content
Advertisement

Passing an html element from anchor tag to django view

I would like to know how i can pass the html link element as a string into a django view and have the information rendered on that specific view. to be clear: I have this

In html

JavaScript

A django view rendered the items from a list and each item would ideally be clickable and the specific item would be passed into this view:

JavaScript

my urls.py reads as :

JavaScript

The problem I think may be that the click action is not actually passing the value into the function based view and I am not sure how to work around this easily. Essentially once the information loads (each item is a link for a specific ticker), I would like the user to be able to click on that link with the ticker being passed into the search_stock function as a string in order to actually render the specific search_stock view.

Much thanks now and in advance.

Advertisement

Answer

try this,

in urls:

JavaScript

in views:

JavaScript

in html:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement