L
L
lemonchik372021-11-21 10:27:40
Django
lemonchik37, 2021-11-21 10:27:40

What needs to be written in the Django HTML template so that when the button is clicked, a random link is displayed?

In general, any page to which the button will lead will only differ in the id of the object
and how to write it so that the button redirects to the page id

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Antonio Solo, 2021-11-21
@solotony

pass this random to the template id
if you need to pass to all templates you can either write django template tag or write context priocessor

A
Alexander Nesterov, 2021-11-21
@AlexNest

In the general case - to transfer all id to the context and use JS to randomize, then change/create a new link.
(How - you can see in the first links in Google for each of the options)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question