Browse Source

work on intern/PRO, korrekt pid implemented

master
Benni Baermann 4 years ago
parent
commit
a0c57c7d4d
4 changed files with 27 additions and 9 deletions
  1. +5
    -5
      input/forms.py
  2. +18
    -0
      input/migrations/0031_auto_20201028_1402.py
  3. +2
    -2
      input/models.py
  4. +2
    -2
      input/views.py

+ 5
- 5
input/forms.py View File

@ -15,7 +15,7 @@ class ProjectForm(ModelForm):
class Meta:
model = Project
exclude = ('pid', 'granted', 'granted_date', 'realname', 'email', 'project_end_mail', 'survey_mail_send')
exclude = ('pid', 'granted', 'granted_date', 'realname', 'email', 'end_mail_send', 'survey_mail_send')
widgets = {'start': AdminDateWidget(),
'end': AdminDateWidget(),}
@ -32,12 +32,12 @@ class ExternForm(ModelForm):
model = Extern
exclude = ('granted', 'granted_date', 'survey_mail_send')
INTERN_CHOICES = [('PRO', 'Projektsteckbrief'),
('HON', 'Ehrenamtsbescheinigung, Akkreditierung oder Redaktionsbestätigung'),
('TRAV', 'Reisekostenerstattung')]
INTERN_CHOICES = {'PRO': 'Projektsteckbrief',
'HON': 'Ehrenamtsbescheinigung, Akkreditierung oder Redaktionsbestätigung',
'TRAV': 'Reisekostenerstattung'}
class InternForm(ModelForm):
choice = ChoiceField(choices = INTERN_CHOICES, widget=RadioSelect,
choice = ChoiceField(choices = INTERN_CHOICES.items(), widget=RadioSelect,
label = 'Was möchtest Du eingeben?')
class Meta:

+ 18
- 0
input/migrations/0031_auto_20201028_1402.py View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.1 on 2020-10-28 14:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0030_auto_20201027_1337'),
]
operations = [
migrations.AlterField(
model_name='project',
name='pid',
field=models.CharField(blank=True, max_length=15, null=True),
),
]

+ 2
- 2
input/models.py View File

@ -41,13 +41,13 @@ class Project(Volunteer):
choices=ACCOUNTS.items(), null=True,)
# the following Fields are not supposed to be edited by users
pid = models.IntegerField(null=True, blank=True)
pid = models.CharField(max_length=15, null=True, blank=True)
end_mail_send = models.BooleanField(null=True)
def save(self,*args,**kwargs):
# is there a way to call super().save() only once?
super().save(*args,*kwargs)
self.pid = 10000 + self.pk
self.pid = self.account + str(self.pk)
super().save(*args,*kwargs)
def __str__(self):

+ 2
- 2
input/views.py View File

@ -11,7 +11,7 @@ from django.template import Context
from .forms import ProjectForm, ExternForm, LibraryForm, IFGForm, LiteratureForm,\
HonoraryCertificateForm, InternForm, TravelForm, EmailForm,\
ListForm, BusinessCardForm
ListForm, BusinessCardForm, INTERN_CHOICES
from .models import Project, TYPE_CHOICES, Library, Literature
from .settings import URLPREFIX, IF_EMAIL
@ -70,7 +70,7 @@ class InternView(CookieWizardView):
if step == '1':
prev_data = self.get_cleaned_data_for_step('0')
choice = prev_data.get('choice')
print(f'choice detection: {TYPE_CHOICES[choice]}')
print(f'choice detection: {INTERN_CHOICES[choice]}')
if choice == 'HON':
form = HonoraryCertificateForm(data)
elif choice == 'PRO':

Loading…
Cancel
Save