【发布时间】:2014-01-28 14:50:54
【问题描述】:
考虑以下几点:
urls.py:
urlpatterns = patterns('',
('^test/$', ClassView.as_view()),
)
views.py:
class ClassView(View):
def get(self, request):
return HttpResponse("test")
def post(self, request):
# do something
return redirect(ClassView.get(request)) # What should I do to redirect to a class here without specifying the path?
我想重定向到 ClassView 的 get 函数 (/test/),但是当我尝试上述方法时,我得到:
NoReverseMatch at /test/
所以它显然找到了 URL 但说没有匹配?
【问题讨论】: