On Friday, January 10, 2014 2:36:56 PM UTC-5, Brad Rice wrote:
>
> I can't seem to find success using success_url
>
> If I try this in my urls.py file
>
> url(r'^step2/', AnswersCreate.as_view(success_url='/requestform/success'),
> name='answers'),
>
> and then in my view:
>
class AnswersCreate(CreateView):
success_url = '/requstform/success'
model=myModel
...
> def form_valid(self, form):
> obj = form.save(commit=False)
> obj.created_by = self.request.user
> obj.save()
> return HttpResponseRedirect(self.get_success_url())
>
A mixin may be necessary, to provide get_success_url method added to the
class.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/f5490254-6cbc-4beb-90f7-92549268d731%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.