B
B
bbquite2021-09-22 10:20:23
Django
bbquite, 2021-09-22 10:20:23

How to make city selection via url in django?

How to implement city selection by url:
For example:
mysite.ru -> main city
mysite.ru/spb/ -> St. Petersburg
, etc.
cities should be added from the admin panel and applied to all site content

ps I know about the existence of the sites framework, but is it interesting to do it this way, and not subdomains?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stefan, 2021-09-22
@MEDIOFF

So what's the problem, write 2 controllers, 1 for the main url, another for mysite.ru/spb/ and write the path to the second controller in the url:

path("<str:region_name>/", <сюда свой второй контроллер>)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question