1. Made location optional, 2. Added multicountry select option, 3.
Improved form labels, help texts and templates.
This commit is contained in:
@@ -39,7 +39,10 @@ class ChoiceSet(object):
|
||||
|
||||
|
||||
class CountryChoiceSet(Countries):
|
||||
first = ['DE', 'AT', 'CH', 'FR', 'IT']
|
||||
override = {
|
||||
'XX': _(u'Länderübergreifend'),
|
||||
}
|
||||
first = ['DE', 'AT', 'CH', 'FR', 'IT', 'XX']
|
||||
first_repeat = True
|
||||
first_break = '--'
|
||||
|
||||
|
||||
@@ -29,24 +29,7 @@ class EventListExportForm(forms.Form):
|
||||
_(u'Format: tt.mm.jjjj'),
|
||||
_(u'Kann frei gelassen werden')
|
||||
),
|
||||
widget = DateWidget(attrs={'id': 'id_begin_widget',
|
||||
'placeholder': _(u'Kann freigelassen werden')},
|
||||
usel10n=True,
|
||||
options={
|
||||
# 'format': 'dd.mm.yyyy',
|
||||
# 'weekStart': 1,
|
||||
'startView': 3,
|
||||
'clearBtn': True,
|
||||
'pickerPosition': 'bottom-left',
|
||||
},
|
||||
bootstrap_version=3))
|
||||
end = forms.DateField(required=False,
|
||||
label=_(u'Zeitraum - Ende'),
|
||||
help_text=u'%s - %s' % (
|
||||
_(u'Format: tt.mm.jjjj'),
|
||||
_(u'Kann frei gelassen werden')
|
||||
),
|
||||
widget = DateWidget(attrs={'id': 'id_end_widget',
|
||||
widget=DateWidget(attrs={'id': 'id_begin_widget',
|
||||
'placeholder': _(u'Kann freigelassen werden')},
|
||||
usel10n=True,
|
||||
options={
|
||||
@@ -57,6 +40,23 @@ class EventListExportForm(forms.Form):
|
||||
'pickerPosition': 'bottom-left',
|
||||
},
|
||||
bootstrap_version=3))
|
||||
end = forms.DateField(required=False,
|
||||
label=_(u'Zeitraum - Ende'),
|
||||
help_text=u'%s - %s' % (
|
||||
_(u'Format: tt.mm.jjjj'),
|
||||
_(u'Kann frei gelassen werden')
|
||||
),
|
||||
widget=DateWidget(attrs={'id': 'id_end_widget',
|
||||
'placeholder': _(u'Kann freigelassen werden')},
|
||||
usel10n=True,
|
||||
options={
|
||||
# 'format': 'dd.mm.yyyy',
|
||||
# 'weekStart': 1,
|
||||
'startView': 3,
|
||||
'clearBtn': True,
|
||||
'pickerPosition': 'bottom-left',
|
||||
},
|
||||
bootstrap_version=3))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(EventListExportForm, self).__init__(*args, **kwargs)
|
||||
@@ -232,32 +232,48 @@ class LocationForm(EventCreateForm):
|
||||
help_text=_(u'Relevant für die Vorauswahl weiterer Felder.'),
|
||||
)
|
||||
|
||||
location = forms.CharField(max_length=config.LOCATION_MAX_LENGTH,
|
||||
location = forms.CharField(required=False,
|
||||
max_length=config.LOCATION_MAX_LENGTH,
|
||||
label=_(u'Ort'),
|
||||
help_text=_(u'z.B. Orts- und Fels- bzw. Bergname, evtl. auch Region,'
|
||||
u' so dass man mindestens eine grobe Vorstellung bekommt,'
|
||||
u' wo das ganze stattfindet.'),
|
||||
widget=forms.TextInput(attrs={'placeholder': u'Karlsruhe'}))
|
||||
help_text=u'%s - %s' % (
|
||||
_(u'Orts- und Fels- bzw. Bergname, evtl. auch Gebirgsgruppe bzw. Region,'
|
||||
u' so dass man mindestens eine grobe Vorstellung bekommt,'
|
||||
u' wo das ganze stattfindet.'),
|
||||
_(u'Kann in Ausnahmefällen (z.B. Streckenwanderung) freigelassen werden')
|
||||
),
|
||||
widget=forms.TextInput(
|
||||
attrs={'placeholder': _(u'Kann in Ausnahmefällen frei gelassen werden')}
|
||||
))
|
||||
|
||||
def _proceed_session_data(self, session_data):
|
||||
super(LocationForm, self)._proceed_session_data(session_data)
|
||||
|
||||
sport = session_data.get('sport', None)
|
||||
last_day = session_data.get('last_day', None)
|
||||
if sport == 'B':
|
||||
self.fields['terrain'].initial = 'alpine'
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'Ramsau, Berchtesgadener Alpen'
|
||||
self.fields['country'].initial = 'FR'
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'z.B. Chamonix, Mont-Blanc-Gruppe'
|
||||
elif sport == 'K':
|
||||
self.fields['terrain'].initial = 'crag'
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'Battert, Baden-Baden'
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'z.B. Battert, Baden-Baden'
|
||||
elif sport == 'M':
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'Pfälzerwald'
|
||||
self.fields['terrain'].initial = 'submountains'
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'z.B. Pfälzerwald'
|
||||
elif sport == 'S' and last_day:
|
||||
self.fields['terrain'].initial = 'alpine'
|
||||
self.fields['country'].initial = 'AT'
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'z.B. Obergurgl, Ötztaler Alpen'
|
||||
elif sport == 'S':
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'Todtnau, Schwarzwald'
|
||||
self.fields['terrain'].initial = 'submountains'
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'z.B. Todtnau, Schwarzwald'
|
||||
elif sport == 'W' and last_day:
|
||||
self.fields['terrain'].initial = 'alpine'
|
||||
self.fields['country'].initial = 'AT'
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'z.B. Ötztaler Alpen'
|
||||
elif sport == 'W':
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'Maikammer, Pfalz'
|
||||
|
||||
if app_config.settings.forms_development_init:
|
||||
self.fields['location'].initial = self.fields['location'].widget.attrs['placeholder']
|
||||
self.fields['terrain'].initial = 'submountains'
|
||||
self.fields['location'].widget.attrs['placeholder'] = u'z.B. Maikammer, Pfalz'
|
||||
|
||||
|
||||
class ApproachForm(EventCreateForm):
|
||||
@@ -643,10 +659,10 @@ class TrainerForm(EventCreateForm):
|
||||
def _proceed_session_data(self, session_data):
|
||||
super(TrainerForm, self)._proceed_session_data(session_data)
|
||||
|
||||
self.fields['trainer_firstname'].widget.attrs['placeholder'] = _(u'Jens')
|
||||
self.fields['trainer_familyname'].widget.attrs['placeholder'] = _(u'Kleineheismann')
|
||||
self.fields['trainer_email'].widget.attrs['placeholder'] = _(u'heinzel@alpenverein-karlsruhe.de')
|
||||
self.fields['trainer_phone'].widget.attrs['placeholder'] = _(u'0150 150 15 01')
|
||||
self.fields['trainer_firstname'].widget.attrs['placeholder'] = _(u'Vorname')
|
||||
self.fields['trainer_familyname'].widget.attrs['placeholder'] = _(u'Nachname')
|
||||
self.fields['trainer_email'].widget.attrs['placeholder'] = _(u'E-Mail-Adresse')
|
||||
self.fields['trainer_phone'].widget.attrs['placeholder'] = _(u'z.B. 0150 150 15 01')
|
||||
self.fields['trainer_2_fullname'].widget.attrs['placeholder'] = _(u'Kann freigelassen werden')
|
||||
self.fields['trainer_2_email'].widget.attrs['placeholder'] = u'--'
|
||||
self.fields['trainer_2_phone'].widget.attrs['placeholder'] = u'--'
|
||||
@@ -659,9 +675,9 @@ class TrainerForm(EventCreateForm):
|
||||
self.fields['trainer_familyname'].initial = self._request.user.last_name
|
||||
self.fields['trainer_email'].initial = self._request.user.email
|
||||
elif app_config.settings.forms_development_init:
|
||||
self.fields['trainer_firstname'].initial = self.fields['trainer_firstname'].widget.attrs['placeholder']
|
||||
self.fields['trainer_familyname'].initial = self.fields['trainer_familyname'].widget.attrs['placeholder']
|
||||
self.fields['trainer_email'].initial = self.fields['trainer_email'].widget.attrs['placeholder']
|
||||
self.fields['trainer_firstname'].initial = _(u'Jens')
|
||||
self.fields['trainer_familyname'].initial = _(u'Kleineheismann')
|
||||
self.fields['trainer_email'].initial = _(u'heinzel@alpenverein-karlsruhe.de')
|
||||
|
||||
|
||||
class ChargesForm(EventCreateForm):
|
||||
|
||||
20
dav_events/migrations/0009_auto_20180207_1118.py
Normal file
20
dav_events/migrations/0009_auto_20180207_1118.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.9 on 2018-02-07 11:18
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dav_events', '0008_auto_20180129_1355'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='event',
|
||||
name='location',
|
||||
field=models.CharField(blank=True, max_length=250),
|
||||
),
|
||||
]
|
||||
22
dav_events/migrations/0010_auto_20180207_1138.py
Normal file
22
dav_events/migrations/0010_auto_20180207_1138.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.9 on 2018-02-07 11:38
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import dav_events.choices
|
||||
from django.db import migrations
|
||||
import django_countries.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dav_events', '0009_auto_20180207_1118'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='event',
|
||||
name='country',
|
||||
field=django_countries.fields.CountryField(countries=dav_events.choices.CountryChoiceSet, max_length=2),
|
||||
),
|
||||
]
|
||||
@@ -82,10 +82,11 @@ class Event(models.Model):
|
||||
course_goal_6 = models.TextField(blank=True)
|
||||
|
||||
# LocationForm
|
||||
country = CountryField()
|
||||
country = CountryField(countries=choices.CountryChoiceSet)
|
||||
terrain = models.CharField(max_length=choices.CHOICE_FIELD_MAX_LENGTH,
|
||||
choices=choices.TERRAIN_CHOICES)
|
||||
location = models.CharField(max_length=config.LOCATION_MAX_LENGTH)
|
||||
location = models.CharField(max_length=config.LOCATION_MAX_LENGTH,
|
||||
blank=True)
|
||||
|
||||
# ApproachForm
|
||||
transport = models.CharField(max_length=choices.CHOICE_FIELD_MAX_LENGTH,
|
||||
@@ -308,8 +309,7 @@ class Event(models.Model):
|
||||
'course_goal_4': self.course_goal_4,
|
||||
'course_goal_5': self.course_goal_5,
|
||||
'course_goal_6': self.course_goal_6,
|
||||
'requirements': self.requirements,
|
||||
'equipment': self.equipment,
|
||||
'country': self.country,
|
||||
'location': self.location,
|
||||
'basecamp': self.basecamp,
|
||||
'accommodation': self.accommodation,
|
||||
@@ -321,13 +321,15 @@ class Event(models.Model):
|
||||
'meeting_time': self.meeting_time,
|
||||
'meeting_point': self.meeting_point,
|
||||
'meeting_point_other': self.meeting_point_other,
|
||||
'requirements': self.requirements,
|
||||
'equipment': self.equipment,
|
||||
'pre_meeting_1': self.pre_meeting_1,
|
||||
'pre_meeting_2': self.pre_meeting_2,
|
||||
'deadline': self.deadline,
|
||||
'min_participants': self.min_participants,
|
||||
'max_participants': self.max_participants,
|
||||
'charge': self.charge,
|
||||
'additional_costs': self.additional_costs,
|
||||
'deadline': self.deadline,
|
||||
'trainer_firstname': self.trainer_firstname,
|
||||
'trainer_familyname': self.trainer_familyname,
|
||||
'trainer_email': self.trainer_email,
|
||||
|
||||
@@ -36,7 +36,7 @@ Die Veranstaltung wurde zur Veröffentlichung frei gegeben.
|
||||
|
||||
{% if requirements %}<strong>{% trans 'Anforderungen' %}:</strong> {{ requirements }}<br />
|
||||
{% endif %}{% if equipment %}<strong>{% trans 'Ausrüstung' %}:</strong> {{ equipment }}<br />
|
||||
{% endif %}{% if location %}<strong>{% trans 'Ort' %}:</strong> {{ location }}<br />
|
||||
{% endif %}{% if location %}<strong>{% trans 'Ort' %}:</strong> {{ location }} {% if country and country != 'DE' and country != 'XX' %}({{ country }}){% endif %}<br />
|
||||
{% endif %}{% if basecamp %}<strong>{% trans 'Stützpunkt' %}:</strong> {{ basecamp }}<br />
|
||||
{% endif %}{% if accommodation and accommodation != 'NONE' %}<strong>{% trans 'Unterkunft' %}:</strong> {% if accommodation == 'OTHER' %}{{ accommodation_other }}{% else %}{{ event.get_accommodation_display }}{% endif %}<br />
|
||||
{% endif %}{% if meals and meals != 'NONE' %}<strong>{% trans 'Verpflegung' %}:</strong> {% if meals == 'OTHER' %}{{ meals_other }}{% else %}{{ event.get_meals_display }}{% endif %}<br />
|
||||
|
||||
@@ -70,7 +70,8 @@
|
||||
<div class="panel-body">
|
||||
{% if requirements %}<strong>{% trans 'Anforderungen' %}:</strong> {{ requirements }}<br />{% endif %}
|
||||
{% if equipment %}<strong>{% trans 'Ausrüstung' %}:</strong> {{ equipment }}<br />{% endif %}
|
||||
{% if location %}<strong>{% trans 'Ort' %}:</strong> {{ location }}<br />{% endif %}
|
||||
{% if location %}<strong>{% trans 'Ort' %}:</strong> {{ location }}
|
||||
{% if country and country != 'DE' and country != 'XX' %}({{ country }}){% endif %}<br />{% endif %}
|
||||
{% if basecamp %}<strong>{% trans 'Stützpunkt' %}:</strong> {{ basecamp }}<br />{% endif %}
|
||||
{% if accommodation and accommodation != 'NONE' %}
|
||||
<strong>{% trans 'Unterkunft' %}:</strong>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
{% endif %}
|
||||
{% if requirements %}{% trans 'Anforderungen' %}: {{ requirements }}
|
||||
{% endif %}{% if equipment %}{% trans 'Ausrüstung' %}: {{ equipment }}
|
||||
{% endif %}{% if location %}{% trans 'Ort' %}: {{ location }}
|
||||
{% endif %}{% if location %}{% trans 'Ort' %}: {{ location }} {% if country and country != 'DE' and country != 'XX' %}({{ country }}){% endif %}
|
||||
{% endif %}{% if basecamp %}{% trans 'Stützpunkt' %}: {{ basecamp }}
|
||||
{% endif %}{% if accommodation and accommodation != 'NONE' %}{% trans 'Unterkunft' %}: {% if accommodation == 'OTHER' %}{{ accommodation_other }}{% else %}{{ event.get_accommodation_display }}{% endif %}
|
||||
{% endif %}{% if meals and meals != 'NONE' %}{% trans 'Verpflegung' %}: {% if meals == 'OTHER' %}{{ meals_other }}{% else %}{{ event.get_meals_display }}{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user