如何在视图中查找命名url?

2024-10-01 17:33:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用一个命名的url填写django表单视图的success_url

class RegisterView(generic.edit.FormView):
    template_name = "cmmods/register.html"
    form_class = RegisterForm
    #success_url = reverse('complete-registration')
    success_url = "/cmmods/complete-registration"

当我显式地输入URL时,就像上面未注释的那样,它可以工作。在

当我尝试反向查找url(上面的当前注释)时,我得到:

The included urlconf 'cm_central.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

我想很明显我的网址.py实际上是有效的(其中确实包含模式),因为代码的未注释版本可以工作。在

我该怎么做?在


Tags: thedjangoin视图url表单registration命名

热门问题