【发布时间】:2017-05-22 19:34:42
【问题描述】:
我有这么长的 url,我想匹配 ? 之后的字符串,并让它在基于类的视图的 self.kwargs 中可用。
new_timer/?UID=046F1572564080&runtime=1102&seconds=30stillrunning=1&numstoredtimes=3&storedtimes=13:2-23:32-48:43&checksum=71
我尝试了以下方法,但它不起作用。
Urlpatterns = [
# bunch of awesome urls
url(r'^new_timer/(?P<params>[^/]+)/$',NewTimerView.as_view(),
name='new_timer'),
]
我做错了什么?
【问题讨论】:
-
"URLconf 搜索请求的 URL,作为普通的 Python 字符串。这不包括 GET 或 POST 参数,或域名。" docs.djangoproject.com/en/1.11/topics/http/urls/…