forked from stephrdev/django-formwizard
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated test apps to work with the new WizardViews.
- Loading branch information
Showing
8 changed files
with
56 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
from django.conf.urls.defaults import * | ||
from test_project.testapp.forms import feedback_form_instance | ||
|
||
from testapp.views import feedback_wizard | ||
|
||
|
||
urlpatterns = patterns('', | ||
url(r'^$', feedback_form_instance, name='feedback_wizard'), | ||
) | ||
url(r'^$', feedback_wizard, name='feedback_wizard'), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from django.shortcuts import render_to_response | ||
from django.template import RequestContext | ||
|
||
from formwizard.views import SessionWizardView | ||
|
||
from testapp.forms import FeedbackStep1, FeedbackStep2, FeedbackStep3 | ||
|
||
|
||
class FeedbackWizard(SessionWizardView): | ||
template_name = 'testapp/form.html' | ||
|
||
def done(self, form_list, *args, **kwargs): | ||
return render_to_response( | ||
'testapp/done.html', | ||
{'form_list': [form.cleaned_data for form in form_list]}, | ||
context_instance=RequestContext(self.request) | ||
) | ||
|
||
feedback_wizard = FeedbackWizard.as_view( | ||
[FeedbackStep1, FeedbackStep2, FeedbackStep3]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from django.conf.urls.defaults import * | ||
from test_project.testapp2.forms import feedback_form_instance | ||
from testapp2.views import feedback_wizard | ||
|
||
urlpatterns = patterns('', | ||
url(r'^$', feedback_form_instance, name='feedback_wizard2'), | ||
) | ||
url(r'^$', feedback_wizard, name='feedback_wizard2'), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from django.shortcuts import render_to_response | ||
from django.template import RequestContext | ||
|
||
from formwizard.views import SessionWizardView | ||
|
||
from testapp2.forms import FeedbackStep1, FeedbackStep2, FeedbackStep3 | ||
|
||
|
||
class FeedbackWizard(SessionWizardView): | ||
template_name = 'testapp/form.html' | ||
|
||
def done(self, form_list, *args, **kwargs): | ||
return render_to_response( | ||
'testapp/done.html', | ||
{'form_list': [form.cleaned_data for form in form_list]}, | ||
context_instance=RequestContext(self.request) | ||
) | ||
|
||
def message_condition(wizard): | ||
data = wizard.get_cleaned_data_for_step('1') or {} | ||
return data.get('leave_message', True) | ||
|
||
feedback_wizard = FeedbackWizard.as_view( | ||
[FeedbackStep1, FeedbackStep2, FeedbackStep3], | ||
condition_dict={'2': message_condition}) |