From bf9e89763c4b1dcd3bfba3f9b743032bb109e91d Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Mon, 2 Nov 2020 14:04:01 +0100 Subject: [PATCH] finished extern forms --- input/forms.py | 2 + input/migrations/0039_auto_20201102_1212.py | 43 +++++++++++++++++++++ input/migrations/0040_auto_20201102_1302.py | 38 ++++++++++++++++++ input/models.py | 20 ++++++++-- 4 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 input/migrations/0039_auto_20201102_1212.py create mode 100644 input/migrations/0040_auto_20201102_1302.py diff --git a/input/forms.py b/input/forms.py index f069b9d..00bb0b1 100644 --- a/input/forms.py +++ b/input/forms.py @@ -50,6 +50,8 @@ class TravelForm(ModelForm): class Meta: model = Travel exclude = ('granted', 'granted_date', 'survey_mail_send', 'realname', 'email',) + widgets = {'checkin': AdminDateWidget(), + 'checkout': AdminDateWidget(),} class LibraryForm(ModelForm): diff --git a/input/migrations/0039_auto_20201102_1212.py b/input/migrations/0039_auto_20201102_1212.py new file mode 100644 index 0000000..7a7fb91 --- /dev/null +++ b/input/migrations/0039_auto_20201102_1212.py @@ -0,0 +1,43 @@ +# Generated by Django 3.1.1 on 2020-11-02 12:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0038_auto_20201102_1055'), + ] + + operations = [ + migrations.AddField( + model_name='travel', + name='checkin', + field=models.DateField(blank=True, null=True, verbose_name='Check In'), + ), + migrations.AddField( + model_name='travel', + name='checkout', + field=models.DateField(blank=True, null=True, verbose_name='Check Out'), + ), + migrations.AddField( + model_name='travel', + name='other_transport', + field=models.CharField(blank=True, max_length=200, null=True, verbose_name='Sonstige Fahrtkosten (mit Begründung)'), + ), + migrations.AddField( + model_name='travel', + name='transport', + field=models.CharField(choices=[('BAHN', 'Bahn'), ('NONE', 'Keine Fahrtkosten'), ('OTHER', 'Sonstiges (mit Begründung)')], default='BAHN', max_length=5), + ), + migrations.AlterField( + model_name='honorarycertificate', + name='request_url', + field=models.CharField(max_length=2000, verbose_name='Antrag (URL)'), + ), + migrations.AlterField( + model_name='travel', + name='request_url', + field=models.CharField(max_length=2000, verbose_name='Antrag (URL)'), + ), + ] diff --git a/input/migrations/0040_auto_20201102_1302.py b/input/migrations/0040_auto_20201102_1302.py new file mode 100644 index 0000000..71dddb8 --- /dev/null +++ b/input/migrations/0040_auto_20201102_1302.py @@ -0,0 +1,38 @@ +# Generated by Django 3.1.1 on 2020-11-02 13:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0039_auto_20201102_1212'), + ] + + operations = [ + migrations.AddField( + model_name='travel', + name='notes', + field=models.CharField(blank=True, max_length=500), + ), + migrations.AddField( + model_name='travel', + name='payed_for_hotel_by', + field=models.CharField(blank=True, choices=[('WMDE', 'WMDE'), ('REQU', 'Antragstellender Mensch')], max_length=4, null=True, verbose_name='Kostenauslage Hotel durch'), + ), + migrations.AddField( + model_name='travel', + name='payed_for_travel_by', + field=models.CharField(blank=True, choices=[('WMDE', 'WMDE'), ('REQU', 'Antragstellender Mensch')], max_length=4, null=True, verbose_name='Kostenauslage Fahrt durch'), + ), + migrations.AddField( + model_name='travel', + name='travelcost', + field=models.CharField(default='0', max_length=10, verbose_name='Fahrtkosten'), + ), + migrations.AlterField( + model_name='travel', + name='other_transport', + field=models.CharField(blank=True, max_length=200, null=True, verbose_name='Sonstige Transportmittel (mit Begründung)'), + ), + ] diff --git a/input/models.py b/input/models.py index d0c8a4b..ef52720 100644 --- a/input/models.py +++ b/input/models.py @@ -82,25 +82,37 @@ class Project(Volunteer): class Intern(Volunteer): '''abstrat base class for data entry from /intern (except Project)''' - request_url = models.CharField(max_length=2000) + request_url = models.CharField(max_length=2000, verbose_name='Antrag (URL)') class Meta: abstract = True - class HonoraryCertificate(Intern): ''' this class is also used for accreditations ''' - # request_url = models.CharField(max_length=2000) project = models.ForeignKey(Project, null=True, blank=True, on_delete=models.SET_NULL) def __str__(self): return "Certificate for " + self.realname +TRANSPORT_CHOICES = {'BAHN': 'Bahn', + 'NONE': 'Keine Fahrtkosten', + 'OTHER': 'Sonstiges (mit Begründung)'} + +PAYEDBY_CHOICES = {'WMDE': 'WMDE', + 'REQU': 'Antragstellender Mensch'} + class Travel(Intern): project = models.ForeignKey(Project, on_delete=models.CASCADE) - + transport = models.CharField(max_length=5, choices=TRANSPORT_CHOICES.items(), default='BAHN') + other_transport = models.CharField(max_length=200, null=True, blank=True, verbose_name='Sonstige Transportmittel (mit Begründung)') + travelcost = models.CharField(max_length=10, default="0", verbose_name="Fahrtkosten") + checkin = models.DateField(blank=True, null=True, verbose_name='Check In') + checkout = models.DateField(blank=True, null=True, verbose_name='Check Out') + payed_for_hotel_by = models.CharField(max_length=4, choices=PAYEDBY_CHOICES.items(), blank=True, null=True, verbose_name='Kostenauslage Hotel durch') + payed_for_travel_by = models.CharField(max_length=4, choices=PAYEDBY_CHOICES.items(), blank=True, null=True, verbose_name='Kostenauslage Fahrt durch') + notes = models.CharField(max_length=500, blank=True) #abstract base class for Library and IFG