Django: manually get view matching url

I have a Django project. Given the url, how can I know which view will be sent to process the request?

+4
source share
1 answer

You want django.core.urlresolvers.resolve , which allows you to map the URL to the view and maintain a separate URL and view the logic. This is the opposite of django.core.urlresolvers.reverse , which allows you to map the view to the url.

See the documentation on how to use it!

+6
source

Source: https://habr.com/ru/post/1303249/


All Articles