May be the better idea will be using something like this http://wbotelhos.com/stepy and show your forms on single page?
Userena with multiple signup forms (form wizard)
-
06-03-2022 - |
Question
I'm trying to setup multiple forms to django-userena signup.
So from django-docs i can do it like this:
forms.py:
class Form1(forms.Form):
some_field = forms.CharField(max_length=100)
email = forms.EmailField()
class Form2(forms.Form):
some_field_2 = forms.CharField(widget=forms.Textarea)
views.py:
class Wizard(SessionWizardView):
def done(self, form_list, **kwargs):
return render_to_response('done.html', {
'form_data': [form.cleaned_data for form in form_list],
})
urls.py:
(r'^signup/$', Wizard.as_view([Form1, Form2])),
And it would be like a one form, placed on two pages with "next" and "previous" buttons.
But userena code has some differences, it should be like this:
views.py:
if userena_settings.USERENA_WITHOUT_USERNAMES and (signup_form == SignupForm):
signup_form = SignupFormOnlyEmail
form = signup_form()
if request.method == 'POST':
form = signup_form(request.POST, request.FILES)
if form.is_valid():
user = form.save()
# Send the signup complete signal
userena_signals.signup_complete.send(sender=None,
user=user)
if success_url: redirect_to = success_url
else: redirect_to = reverse('userena_signup_complete',
kwargs={'username': user.username})
# A new signed user should logout the old one.
if request.user.is_authenticated():
logout(request)
return redirect(redirect_to)
if not extra_context: extra_context = dict()
extra_context['form'] = form
return ExtraContextTemplateView.as_view(template_name=template_name,
extra_context=extra_context)(request)
urls.py:
url(r'^accounts/signup/$', 'userena.views.signup', {'signup_form': SignupFormExtra}),
So my great problem here - to integrate this two things, but I don't even know from what should I begin.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow