Browse Source

hotel in forms.py is now radioselect choicefield and required

master
Benni Bärmann 1 year ago
parent
commit
f35a788fd0
3 changed files with 30 additions and 2 deletions
  1. +7
    -1
      input/forms.py
  2. +18
    -0
      input/migrations/0088_auto_20221208_2128.py
  3. +5
    -1
      input/models.py

+ 7
- 1
input/forms.py View File

@ -54,6 +54,11 @@ class InternForm(FdbForm):
exclude = ('granted', 'granted_date', 'survey_mail_send', 'survey_mail_date', 'mail_state') 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): class TravelForm(FdbForm):
# TODO: add some javascript to show/hide other-field # TODO: add some javascript to show/hide other-field
@ -65,7 +70,7 @@ class TravelForm(FdbForm):
self.fields['travelcost'].required = True self.fields['travelcost'].required = True
self.fields['checkin'].required = True self.fields['checkin'].required = True
self.fields['checkout'].required = True self.fields['checkout'].required = True
self.fields['hotel'].required = False
self.fields['hotel'].required = True
class Meta: class Meta:
model = Travel model = Travel
@ -73,6 +78,7 @@ class TravelForm(FdbForm):
widgets = {'checkin': AdminDateWidget(), widgets = {'checkin': AdminDateWidget(),
'checkout': AdminDateWidget(),} 'checkout': AdminDateWidget(),}
fields = ['project_name', 'transport', 'travelcost', 'checkin', 'checkout', 'hotel', 'notes'] fields = ['project_name', 'transport', 'travelcost', 'checkin', 'checkout', 'hotel', 'notes']
hotel = ChoiceField(label='Hotelzimmer benötigt:', choices=HOTEL_CHOICES.items(), widget=RadioSelect())
class Media: class Media:
css = { css = {

+ 18
- 0
input/migrations/0088_auto_20221208_2128.py View File

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

+ 5
- 1
input/models.py View File

@ -173,6 +173,10 @@ TRANSPORT_CHOICES = {'BAHN': 'Bahn',
PAYEDBY_CHOICES = {'WMDE': 'WMDE', PAYEDBY_CHOICES = {'WMDE': 'WMDE',
'REQU': 'Antragstellender Mensch'} '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 from django.contrib.contenttypes.models import ContentType
class Travel(Volunteer): class Travel(Volunteer):
@ -186,7 +190,7 @@ class Travel(Volunteer):
checkout = models.DateTimeField(blank=True, null=True, verbose_name='Abreise') 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_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') 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') notes = models.TextField(max_length=1000, blank=True, verbose_name='Anmerkungen')
request_url = models.URLField(max_length=2000, verbose_name='Antrag (URL)') request_url = models.URLField(max_length=2000, verbose_name='Antrag (URL)')
intern_notes = models.TextField(max_length=1000, blank=True, verbose_name='interne Anmerkungen') intern_notes = models.TextField(max_length=1000, blank=True, verbose_name='interne Anmerkungen')

Loading…
Cancel
Save