finished extern forms

This commit is contained in:
Benni Baermann 2020-11-02 14:04:01 +01:00
parent 03a413cb44
commit bf9e89763c
4 changed files with 99 additions and 4 deletions

View file

@ -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):

View file

@ -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)'),
),
]

View file

@ -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)'),
),
]

View file

@ -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