开发者

Django: Manually getting the view corresponding to a URL

开发者 https://www.devze.com 2022-12-22 04:45 出处:网络
I have a Django project. Gi开发者_开发问答ven a url, how can I know which view will be dispatched to handle the request?You want django.core.urlresolvers.resolve, which allows you to map an URL to a v

I have a Django project. Gi开发者_开发问答ven a url, how can I know which view will be dispatched to handle the request?


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

See the documentation for how to use it!

0

精彩评论

暂无评论...
验证码 换一张
取 消