From 7d38549c3dec3a720ff900a3fb18918eda55abbb Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Mon, 19 Oct 2020 14:04:34 +0200 Subject: [PATCH] unfied CHOICES into one global list --- input/forms.py | 10 ++-------- input/models.py | 9 ++++++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/input/forms.py b/input/forms.py index 019d773..3e0d865 100644 --- a/input/forms.py +++ b/input/forms.py @@ -2,7 +2,7 @@ from django.db import models from django.forms import ModelForm, DateField, ChoiceField, RadioSelect from django.contrib.admin.widgets import AdminDateWidget -from .models import Project, Volunteer, IFG, Library +from .models import Project, Volunteer, IFG, Library, TYPE_CHOICES class ProjectForm(ModelForm): @@ -15,13 +15,7 @@ class ProjectForm(ModelForm): class VolunteerForm(ModelForm): - CHOICES = [('BIB', 'Bibliotheksstipendium'), - ('ELIT', 'eLiteraturstipendium'), - ('SOFT', 'Softwarestipendium'), - ('VIS', 'Visitenkarten, Mailingliste oder E-Mail-Adresse'), - ('IFG', 'Kostenübernahme IFG-Anfrage'), - ('LIT', 'Literaturstipendium'),] - choice = ChoiceField(choices=CHOICES, widget=RadioSelect) + choice = ChoiceField(choices=TYPE_CHOICES, widget=RadioSelect) class Meta: model = Volunteer diff --git a/input/models.py b/input/models.py index 29cc7f5..e70e26b 100644 --- a/input/models.py +++ b/input/models.py @@ -41,9 +41,12 @@ class Grant(Volunteer): # same model is used for Library, ELitStip and Software! TYPE_CHOICES = [('BIB', 'Bibliotheksstipendium'), - ('ELIT', 'eLiteraturstipendium'), - ('SOFT', 'Softwarestipendium')] - + ('ELIT', 'eLiteraturstipendium'), + ('SOFT', 'Softwarestipendium'), + ('VIS', 'Visitenkarten, Mailingliste oder E-Mail-Adresse'), + ('IFG', 'Kostenübernahme IFG-Anfrage'), + ('LIT', 'Literaturstipendium'),] + class Library(Grant): type = models.CharField(