Passing arguments to views in Django from constrained choices

送分小仙女□ 提交于 2019-12-05 18:50:40

Remember that you have the full power of regexes to match URLs. You simply need to write a regex that accepts only what you want:

(r'^friends/(?P<type>requests|offers)', 'app.views.pendingFriends'),

If you want to list it twice, do it like this:

(r'^friends/(?P<type>requests)', 'app.views.pendingFriends'),
(r'^friends/(?P<type>offers)', 'app.views.pendingFriends'),
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!