added view for multipage form
This commit is contained in:
parent
28204aeab7
commit
e66be49e2d
3 changed files with 18 additions and 9 deletions
|
@ -22,12 +22,12 @@ class VolunteerForm(ModelForm):
|
|||
model = Volunteer
|
||||
fields = '__all__'
|
||||
|
||||
class LibraryForm:
|
||||
class LibraryForm(ModelForm):
|
||||
class Meta:
|
||||
model = Library
|
||||
fields = '__all__'
|
||||
|
||||
class IFGForm:
|
||||
class IFGForm(ModelForm):
|
||||
class Meta:
|
||||
model = 'IFG'
|
||||
model = IFG
|
||||
fields = '__all__'
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
from .views import intern, ExternView, done
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.intern, name='intern'),
|
||||
path('extern', views.extern, name='extern'),
|
||||
path('saved', views.done, name='done')
|
||||
path('', intern, name='intern'),
|
||||
path('extern', ExternView.as_view(), name='extern'),
|
||||
path('saved', done, name='done')
|
||||
]
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
from django.shortcuts import render
|
||||
from django.forms import modelformset_factory
|
||||
from .models import Project
|
||||
from .forms import ProjectForm
|
||||
from django.http import HttpResponse
|
||||
from formtools.wizard.views import SessionWizardView
|
||||
|
||||
from .forms import ProjectForm, VolunteerForm, LibraryForm
|
||||
from .models import Project
|
||||
|
||||
def intern(request):
|
||||
# return HttpResponse("Hello, world. You're at the input form")
|
||||
|
@ -28,3 +29,11 @@ def done(request):
|
|||
|
||||
def extern(request):
|
||||
return HttpResponse("The world out there is large and dangerous")
|
||||
|
||||
class ExternView(SessionWizardView):
|
||||
template_name = "path/to/template"
|
||||
form_list = [VolunteerForm, LibraryForm]
|
||||
def done(self, form_list, **kwargs):
|
||||
return render(self.request, 'done.html', {
|
||||
'form_data': [form.cleaned_data for form in form_list],
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue