当前路径account / active / Z1s6IYaohOJWeRV4与以下任何路径都不匹配

时间:2019-10-30 15:45:29

标签: django

enter image description here

urls.py:

path('active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name='active_user'),

views.py:

class ActiveUserView(View):
    def get(self,request,active_code):
        users = UserProfile.objects.filter(code=active_code)       
        if users:          
            users.is_active = True
            users.save()  
        else:
            users.delete()       
            return HttpResponse('Fail!Register Again!')
        return HttpResponseRedirect(reverse("account:user_login"))

0 个答案:

没有答案