Home Django: redirect to DetailView without pk in URL

# Django: redirect to DetailView without pk in URL

user5918
1#
user5918 Published in September 21, 2018, 2:47 am

I want to make sign-up forms with Django1.11.

urls.py

app_name = 'accounts'

urlpatterns = [
url(r'^create/$', views.SignUpView.as_view(), name='create'), url(r'^check/$', views.CheckView.as_view(), name='check'),
url(r'^update/$', views.CorrectView.as_view(), name='update'), # ... ] views.py class SignUpView(CreateView): model = User form_class = UserForm template_name = "accounts/create.html" def get_success_url(self): check_view = CheckView.as_view() return redirect(check_view, pk=self.object.pk) class CheckView(DetailView): model = User template_name = "accounts/check.html" class CorrectView(UpdateView): model = User form_class = UserForm template_name = "accounts/create.html" def get_success_url(self): check_view = CheckView.as_view() return redirect(check_view, pk=self.object.pk) After a new user inputs his information in SignUpView(generic.CreateView), he will see what he just has input in CheckView(generic.DetailView), and if he notice that he has made some mistakes, he reinput his information in CorrectView(generic.UpdateView). I want not to make url r'^check/(?P<pk>[0-9]+)$' for example. This is because if an user inputs a URL .../check/1 for example in browser, unfortunately he can see the information of another person.

When I run the code above, the error Reverse for 'accounts.views.CheckView' not found. 'accounts.views.CheckView' is not a valid view function or pattern name. is occurred. Please tell me how to redirect to CheckView(generic.DetailView) without url include pk.

• Are you using authentication here, so just you can show only authenticated user's infromation? – Vaibhav Mule Dec 5 '17 at 1:02