Browse Source

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

master
Benni Baermann 4 years ago
parent
commit
7ab8c956b1
4 changed files with 39 additions and 11 deletions
  1. +2
    -2
      input/forms.py
  2. +18
    -0
      input/migrations/0013_library_type.py
  3. +11
    -2
      input/models.py
  4. +8
    -7
      input/templates/input/if_mail.txt

+ 2
- 2
input/forms.py View File

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

+ 18
- 0
input/migrations/0013_library_type.py 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),
),
]

+ 11
- 2
input/models.py View File

@ -39,16 +39,25 @@ class Grant(Volunteer):
class Meta:
abstract = True
# should be identical for ELitStip and Software?
# same model is used for Library, ELitStip and Software!
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)
duration = models.CharField(max_length=100)
def __str__(self):
return self.library
class IFG(Grant):
url = models.CharField(max_length=2000)
url = models.CharField(max_length=2000)
def __str__(self):
return "IFG-Anfrage von " + self.realname

+ 8
- 7
input/templates/input/if_mail.txt View File

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

Loading…
Cancel
Save