B
B
blackbb2017-05-08 01:29:38
Django
blackbb, 2017-05-08 01:29:38

How to pass user's city selection to views?

The site has a definition of the city by ip, plus the user can change this definition to any other city. I need, depending on the city, to filter the content on all pages where the user will go. That's actually the question of how to pass the value of the city to views.py, so that later it can be used in all output functions.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maxfox, 2017-05-08
@blackbb

Optimal - store in cookies.
If stored in session, then, most likely, repeated queries to the database cannot be avoided.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question