diff --git a/input/forms.py b/input/forms.py index 152cc97..48600af 100755 --- a/input/forms.py +++ b/input/forms.py @@ -54,6 +54,11 @@ class InternForm(FdbForm): exclude = ('granted', 'granted_date', 'survey_mail_send', 'survey_mail_date', 'mail_state') +HOTEL_CHOICES = {'TRUE': format_html('Hotelzimmer benötigt'), + 'FALSE': format_html('Kein Hotelzimmer benötigt') + } + + class TravelForm(FdbForm): # TODO: add some javascript to show/hide other-field @@ -65,7 +70,7 @@ class TravelForm(FdbForm): self.fields['travelcost'].required = True self.fields['checkin'].required = True self.fields['checkout'].required = True - self.fields['hotel'].required = False + self.fields['hotel'].required = True class Meta: model = Travel @@ -73,6 +78,7 @@ class TravelForm(FdbForm): widgets = {'checkin': AdminDateWidget(), 'checkout': AdminDateWidget(),} fields = ['project_name', 'transport', 'travelcost', 'checkin', 'checkout', 'hotel', 'notes'] + hotel = ChoiceField(label='Hotelzimmer benötigt:', choices=HOTEL_CHOICES.items(), widget=RadioSelect()) class Media: css = { diff --git a/input/migrations/0088_auto_20221208_2128.py b/input/migrations/0088_auto_20221208_2128.py new file mode 100644 index 0000000..9291efe --- /dev/null +++ b/input/migrations/0088_auto_20221208_2128.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.2 on 2022-12-08 21:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0087_travel_project_end_quartal'), + ] + + operations = [ + migrations.AlterField( + model_name='travel', + name='hotel', + field=models.CharField(choices=[('TRUE', 'Hotelzimmer benötigt'), ('FALSE', 'Kein Hotelzimmer benötigt')], max_length=10, verbose_name='Hotelzimmer benötigt:'), + ), + ] diff --git a/input/models.py b/input/models.py index 4b45457..d1d00e0 100755 --- a/input/models.py +++ b/input/models.py @@ -173,6 +173,10 @@ TRANSPORT_CHOICES = {'BAHN': 'Bahn', PAYEDBY_CHOICES = {'WMDE': 'WMDE', 'REQU': 'Antragstellender Mensch'} +HOTEL_CHOICES = {'TRUE': format_html('Hotelzimmer benötigt'), + 'FALSE': format_html('Kein Hotelzimmer benötigt') + } + from django.contrib.contenttypes.models import ContentType class Travel(Volunteer): @@ -186,7 +190,7 @@ class Travel(Volunteer): checkout = models.DateTimeField(blank=True, null=True, verbose_name='Abreise') 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') - hotel = models.BooleanField(default=False, verbose_name='Hotelzimmer benötigt:') + hotel = models.CharField(max_length=10, choices=HOTEL_CHOICES.items(), verbose_name='Hotelzimmer benötigt:') notes = models.TextField(max_length=1000, blank=True, verbose_name='Anmerkungen') request_url = models.URLField(max_length=2000, verbose_name='Antrag (URL)') intern_notes = models.TextField(max_length=1000, blank=True, verbose_name='interne Anmerkungen')