是否可以在以下之间进行匹配:
中的 urls 正则表达式定义 urls.py:
...
url(r'^edit_notification/(?P<foo>\d+)/$', 'edit_notification')
...
和 views.py:
中的方法签名
def edit_notification(request, foo):
...
Django 中的 GET 参数?
或者唯一的方法是外部内部方法 request.GET.get('foo')
最佳答案
GET
参数 are not matched by the url configuration :
What the URLconf searches against The URLconf searches against the requested URL, as a normal Python string. This does not include GET or POST parameters, or the domain name.
它们是HttpRequest
对象的一部分,并保存在request.GET
内查询字典
def edit_notification(request):
foo = request.GET.get('foo')
...
关于python - django查看方法签名是否可以匹配GET参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24214987/