new type field for Library/Software/eLit, finetuning mail conditions

This commit is contained in:
Benni Bärmann 2020-10-19 11:56:10 +02:00
parent af767b9d08
commit 7ab8c956b1
4 changed files with 39 additions and 11 deletions

View File

@ -20,7 +20,7 @@ class VolunteerForm(ModelForm):
('SOFT', 'Softwarestipendium'), ('SOFT', 'Softwarestipendium'),
('VIS', 'Visitenkarten, Mailingliste oder E-Mail-Adresse'), ('VIS', 'Visitenkarten, Mailingliste oder E-Mail-Adresse'),
('IFG', 'Kostenübernahme IFG-Anfrage'), ('IFG', 'Kostenübernahme IFG-Anfrage'),
('LIB', 'library'),] ('LIT', 'Literaturstipendium'),]
choice = ChoiceField(choices=CHOICES, widget=RadioSelect) choice = ChoiceField(choices=CHOICES, widget=RadioSelect)
class Meta: class Meta:
@ -30,7 +30,7 @@ class VolunteerForm(ModelForm):
class LibraryForm(ModelForm): class LibraryForm(ModelForm):
class Meta: class Meta:
model = Library model = Library
exclude = ('realname', 'email', 'username') exclude = ('realname', 'email', 'username', 'type')
class IFGForm(ModelForm): class IFGForm(ModelForm):
class Meta: class Meta:

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.1 on 2020-10-19 09:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0012_auto_20201007_0754'),
]
operations = [
migrations.AddField(
model_name='library',
name='type',
field=models.CharField(choices=[('LIB', 'Bibliotheksstipendium'), ('ELIT', 'eLiteraturstipendium'), ('SOFT', 'Softwarestipendium')], default='LIB', max_length=4),
),
]

View File

@ -39,11 +39,20 @@ class Grant(Volunteer):
class Meta: class Meta:
abstract = True abstract = True
# should be identical for ELitStip and Software? # same model is used for Library, ELitStip and Software!
class Library(Grant): class Library(Grant):
TYPE_CHOICES = [('LIB', 'Bibliotheksstipendium'),
('ELIT', 'eLiteraturstipendium'),
('SOFT', 'Softwarestipendium')]
type = models.CharField(
max_length=4,
choices=TYPE_CHOICES,
default='LIB',
)
library = models.CharField(max_length=200) library = models.CharField(max_length=200)
duration = models.CharField(max_length=100) duration = models.CharField(max_length=100)
def __str__(self): def __str__(self):
return self.library return self.library

View File

@ -3,13 +3,14 @@ Hallo Team Ideenförderung,
es gab einen neuen Antrag von {{data.realname}}. es gab einen neuen Antrag von {{data.realname}}.
Username {{data.username}} fragt ein Username {{data.username}} fragt ein
{% if data.choice == 'LIB' %} Literaturstipendium {% endif %} {% if data.choice == 'LIT' %} Literaturstipendium
{% if data.choice == 'BIB' %} Bibliotheksstipendium {% endif %} {% elif data.choice == 'BIB' %} Bibliotheksstipendium
{% if data.choice == 'IFG' %} IFG {% endif %} {% elif data.choice == 'IFG' %} IFG
{% if data.choice == 'ELIT' %} eLiteraturstipendium {% endif %} {% elif data.choice == 'ELIT' %} eLiteraturstipendium
{% if data.choice == 'SOFT' %} Softwarestipendium {% endif %} {% elif data.choice == 'SOFT' %} Softwarestipendium
{% if data.choice == 'VIS' %} Visitenkarten, Mailingliste oder E-Mail-Adresse {% endif %} {% elif data.choice == 'VIS' %} Visitenkarten, Mailingliste oder E-Mail-Adresse
{% else %} ERROR UNKNOWN FORMTYPE
{% endif %}
an. an.
Genehmigen: INSERT Link here Genehmigen: INSERT Link here