From 28204aeab7889c4d2cd129ba44adcbe1048cb639 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Thu, 1 Oct 2020 10:51:19 +0200 Subject: [PATCH] added forms for multistep forms --- foerderbarometer/settings.py | 1 + input/forms.py | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/foerderbarometer/settings.py b/foerderbarometer/settings.py index d9249c9..abea68d 100644 --- a/foerderbarometer/settings.py +++ b/foerderbarometer/settings.py @@ -38,6 +38,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'formtools', ] MIDDLEWARE = [ diff --git a/input/forms.py b/input/forms.py index 7105931..7c33a8a 100644 --- a/input/forms.py +++ b/input/forms.py @@ -1,8 +1,8 @@ from django.db import models -from django.forms import ModelForm, DateField +from django.forms import ModelForm, DateField, ChoiceField, RadioSelect from django.contrib.admin.widgets import AdminDateWidget -from .models import Project +from .models import Project, Volunteer, IFG, Library class ProjectForm(ModelForm): @@ -11,3 +11,23 @@ class ProjectForm(ModelForm): class Meta: model = Project fields = '__all__' + +class VolunteerForm(ModelForm): + + CHOICES = [('IFG','ifg'), + ('Lib','library'),] + choice = ChoiceField(choices=CHOICES, widget=RadioSelect) + + class Meta: + model = Volunteer + fields = '__all__' + +class LibraryForm: + class Meta: + model = Library + fields = '__all__' + +class IFGForm: + class Meta: + model = 'IFG' + fields = '__all__'