Added field registration_required.
This commit is contained in:
2
TODO.txt
2
TODO.txt
@@ -1,4 +1,3 @@
|
||||
- teilnehmerzahl (im template): check if min == max
|
||||
- Anzeige Bahnfahrt
|
||||
- ApproachForm aufteilen
|
||||
- Save as Draft
|
||||
@@ -12,7 +11,6 @@
|
||||
- vorbereitung: textfeld beschreibung einleitung, so dass beschreibung nur auf webseite geht.
|
||||
- kontaktdaten für 2. und 3. trainer wieder weg
|
||||
- erster teil des anmeldungshowto editierbar
|
||||
- feld 'anmeldung nicht nötig'
|
||||
- publizierendes feld für redaktionellen hinweis
|
||||
- vortreffen ohne datum?
|
||||
|
||||
|
||||
@@ -617,6 +617,10 @@ class RegistrationForm(EventCreateForm):
|
||||
max_participants = forms.IntegerField(min_value=0,
|
||||
label=_(u'Max. Teilnehmer'))
|
||||
|
||||
registration_required = forms.BooleanField(required=False,
|
||||
label=_(u'Anmeldung notwendig'),
|
||||
)
|
||||
|
||||
deadline = forms.ChoiceField(choices=choices.DEADLINE_CHOICES,
|
||||
label=_(u'Anmeldeschluss'),
|
||||
widget=forms.RadioSelect())
|
||||
@@ -827,8 +831,8 @@ class SummaryForm(EventCreateForm):
|
||||
widget=forms.Textarea(attrs={'rows': 5}))
|
||||
|
||||
def _proceed_session_data(self, session_data):
|
||||
max_participants = self._session_data.get('max_participants', 0)
|
||||
if max_participants:
|
||||
registration_required = self._session_data.get('registration_required', False)
|
||||
if registration_required:
|
||||
deadline = self._session_data.get('deadline', None)
|
||||
if deadline == 'OTHER':
|
||||
deadline = self._session_data.get('deadline_other', None)
|
||||
|
||||
20
dav_events/migrations/0016_event_registration_required.py
Normal file
20
dav_events/migrations/0016_event_registration_required.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.9 on 2018-02-26 16:55
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dav_events', '0015_auto_20180226_1253'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='event',
|
||||
name='registration_required',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
||||
@@ -131,13 +131,6 @@ class Event(models.Model):
|
||||
pre_meeting_2 = models.DateTimeField(blank=True,
|
||||
null=True)
|
||||
|
||||
# RegistrationForm
|
||||
min_participants = models.IntegerField(default=0)
|
||||
max_participants = models.IntegerField(default=0)
|
||||
deadline = models.DateField(blank=True,
|
||||
null=True)
|
||||
registration_howto = models.TextField(blank=True)
|
||||
|
||||
# TrainerForm
|
||||
trainer_firstname = models.CharField(max_length=config.TRAINER_NAME_MAX_LENGTH,
|
||||
blank=True)
|
||||
@@ -157,6 +150,14 @@ class Event(models.Model):
|
||||
trainer_3_phone = models.CharField(max_length=config.PHONE_NUMBER_MAX_LENGTH,
|
||||
blank=True)
|
||||
|
||||
# RegistrationForm
|
||||
min_participants = models.IntegerField(default=0)
|
||||
max_participants = models.IntegerField(default=0)
|
||||
registration_required = models.BooleanField(default=False)
|
||||
deadline = models.DateField(blank=True,
|
||||
null=True)
|
||||
registration_howto = models.TextField(blank=True)
|
||||
|
||||
# ChargesForm
|
||||
charge = models.FloatField(default=0)
|
||||
additional_costs = models.CharField(max_length=config.ADDITIONAL_COSTS_MAX_LENGTH,
|
||||
@@ -381,9 +382,10 @@ class Event(models.Model):
|
||||
'event': self,
|
||||
'status': self.get_status(),
|
||||
'number': self.get_number(),
|
||||
'title': self.title,
|
||||
'description': self.description,
|
||||
'mode': self.mode,
|
||||
'sport': self.sport,
|
||||
'title': self.title,
|
||||
'first_day': self.first_day,
|
||||
'last_day': self.last_day,
|
||||
'normalized_date': self.get_formated_date(format='normalized'),
|
||||
@@ -394,7 +396,6 @@ class Event(models.Model):
|
||||
'alt_normalized_date': self.get_alt_formated_date(format='normalized'),
|
||||
'alt_normalized_long_date': self.get_alt_formated_date(format='normalized_long'),
|
||||
'alt_normalized_short_date': self.get_alt_formated_date(format='normalized_short'),
|
||||
'description': self.description,
|
||||
'course_topic_1': self.course_topic_1,
|
||||
'course_topic_2': self.course_topic_2,
|
||||
'course_topic_3': self.course_topic_3,
|
||||
@@ -409,25 +410,20 @@ class Event(models.Model):
|
||||
'course_goal_6': self.course_goal_6,
|
||||
'country': self.country,
|
||||
'location': self.location,
|
||||
'basecamp': self.basecamp,
|
||||
'accommodation': self.accommodation,
|
||||
'accommodation_other': self.accommodation_other,
|
||||
'meals': self.meals,
|
||||
'meals_other': self.meals_other,
|
||||
'transport': self.transport,
|
||||
'transport_other': self.transport_other,
|
||||
'meeting_time': self.meeting_time,
|
||||
'meeting_point': self.meeting_point,
|
||||
'meeting_point_other': self.meeting_point_other,
|
||||
'basecamp': self.basecamp,
|
||||
'accommodation': self.accommodation,
|
||||
'accommodation_other': self.accommodation_other,
|
||||
'meals': self.meals,
|
||||
'meals_other': self.meals_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,
|
||||
'trainer_firstname': self.trainer_firstname,
|
||||
'trainer_familyname': self.trainer_familyname,
|
||||
'trainer_email': self.trainer_email,
|
||||
@@ -438,7 +434,13 @@ class Event(models.Model):
|
||||
'trainer_3_fullname': self.trainer_3_fullname,
|
||||
'trainer_3_email': self.trainer_3_email,
|
||||
'trainer_3_phone': self.trainer_3_phone,
|
||||
'min_participants': self.min_participants,
|
||||
'max_participants': self.max_participants,
|
||||
'registration_required': self.registration_required,
|
||||
'deadline': self.deadline,
|
||||
'registration_howto': self.registration_howto,
|
||||
'charge': self.charge,
|
||||
'additional_costs': self.additional_costs,
|
||||
'planned_publication_date': self.planned_publication_date,
|
||||
'internal_note': self.internal_note,
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ Veröffentlichung: {% if planned_publication_date %}{{ planned_publication_date|
|
||||
{% endif %}{% if pre_meeting_1 %}{% if pre_meeting_2 %}<strong>{% trans 'Vortreffen' %} 1:</strong> {{ pre_meeting_1|date:'l, d. F Y, G:i'|cut:':00' }} {% trans 'Uhr' %}, DAV {% trans 'Sektionszentrum' %}<br />
|
||||
<strong>{% trans 'Vortreffen' %} 2:</strong> {{ pre_meeting_2|date:'l, d. F Y, G:i'|cut:':00' }} {% trans 'Uhr' %}, DAV {% trans 'Sektionszentrum' %}<br />
|
||||
{% else %}<strong>{% trans 'Vortreffen' %}:</strong> {{ pre_meeting_1|date:'l, d. F Y, G:i'|cut:':00' }} {% trans 'Uhr' %}, DAV {% trans 'Sektionszentrum' %}<br />{% endif %}
|
||||
{% endif %}{% if min_participants > 0 or max_participants > 0 %}<strong>{% trans 'Teilnehmerzahl' %}:</strong> {% if min_participants > 0 and max_participants > 0 %}{{ min_participants }} - {{ max_participants }} {% trans 'Teilnehmer' %}{% elif min_participants > 0 %}min. {{ min_participants }} {% trans 'Teilnehmer' %}{% else %}max. {{ max_participants }} {% trans 'Teilnehmer' %}{% endif %}<br />
|
||||
{% endif %}{% if min_participants > 0 or max_participants > 0 %}<strong>{% trans 'Teilnehmerzahl' %}:</strong> {% if min_participants == max_participants %}{{ max_participants }} {% trans 'Teilnehmer' %}{% elif min_participants > 0 and max_participants > 0 %}{{ min_participants }} - {{ max_participants }} {% trans 'Teilnehmer' %}{% elif min_participants > 0 %}min. {{ min_participants }} {% trans 'Teilnehmer' %}{% else %}max. {{ max_participants }} {% trans 'Teilnehmer' %}{% endif %}<br />
|
||||
{% endif %}{% if charge > 0 or additional_costs %}<strong>{% trans 'Kosten' %}:</strong> {% if charge > 0 %}{{ charge|floatformat:'-2' }} € {% trans 'Teilnahmegebühr' %}{% endif %}{% if additional_costs %}{% if charge > 0 %} {% trans 'zzgl.' %} {% endif %}{{ additional_costs }}{% endif %}<br />
|
||||
{% endif %}{% if deadline %}<strong>{% trans 'Anmeldeschluss' %}:</strong> {{ deadline|date:'l, d. F Y' }}<br />
|
||||
{% endif %}{% if registration_required and deadline %}<strong>{% trans 'Anmeldeschluss' %}:</strong> {{ deadline|date:'l, d. F Y' }}<br />
|
||||
{% endif %}{% if trainer_2_fullname %}{% if mode == 'training' %}<strong>{% trans 'Ausbildungsteam' %}:</strong>{% else %}<strong>{% trans 'Team' %}:</strong>{% endif %} {{ trainer_firstname }} {{ trainer_familyname }}{% if trainer_email or trainer_phone %} ({% if trainer_email %}<a href="mailto:{{ trainer_email }}">{{ trainer_email }}</a>{% endif %}{% if trainer_email and trainer_phone %}, {% endif %}{% if trainer_phone %}{{ trainer_phone }}{% endif %}){% endif %}, {{ trainer_2_fullname }}{% if trainer_2_email or trainer_2_phone %} ({% if trainer_2_email %}<a href="mailto:{{ trainer_2_email }}">{{ trainer_2_email }}</a>{% endif %}{% if trainer_2_email and trainer_2_phone %}, {% endif %}{% if trainer_2_phone %}{{ trainer_2_phone }}{% endif %}){% endif %}{% if trainer_3_fullname %}, {{ trainer_3_fullname }}{% if trainer_3_email or trainer_3_phone %} ({% if trainer_3_email %}<a href="mailto:{{ trainer_3_email }}">{{ trainer_3_email }}</a>{% endif %}{% if trainer_3_email and trainer_3_phone %}, {% endif %}{% if trainer_3_phone %}{{ trainer_3_phone }}{% endif %}){% endif %}{% endif %}<br />
|
||||
{% endif %}{% if trainer_familyname %}<strong>{% trans 'Leitung' %}:</strong> {{ trainer_firstname }} {{ trainer_familyname }}{% if trainer_email or trainer_phone %} ({% if trainer_email %}<a href="mailto:{{ trainer_email }}">{{ trainer_email }}</a>{% endif %}{% if trainer_email and trainer_phone %}, {% endif %}{% if trainer_phone %} {{ trainer_phone }}{% endif %}){% endif %}
|
||||
{% endif %}{% if registration_howto %}
|
||||
{% endif %}{% if registration_required and registration_howto %}
|
||||
<p>{{ registration_howto }}</p>
|
||||
{% endif %}
|
||||
|
||||
@@ -133,7 +133,9 @@
|
||||
{% endif %}
|
||||
{% if min_participants > 0 or max_participants > 0 %}
|
||||
<strong>{% trans 'Teilnehmerzahl' %}:</strong>
|
||||
{% if min_participants > 0 and max_participants > 0 %}
|
||||
{% if min_participants == max_participants %}
|
||||
{{ max_participants }} {% trans 'Teilnehmer' %}
|
||||
{% elif min_participants > 0 and max_participants > 0 %}
|
||||
{{ min_participants }} - {{ max_participants }} {% trans 'Teilnehmer' %}
|
||||
{% elif min_participants > 0 %}
|
||||
min. {{ min_participants }} {% trans 'Teilnehmer' %}
|
||||
@@ -153,7 +155,7 @@
|
||||
{% endif %}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% if deadline %}<strong>{% trans 'Anmeldeschluss' %}:</strong> {{ deadline|date:'l, d. F Y' }}<br />{% endif %}
|
||||
{% if registration_required and deadline %}<strong>{% trans 'Anmeldeschluss' %}:</strong> {{ deadline|date:'l, d. F Y' }}<br />{% endif %}
|
||||
{% if trainer_2_fullname %}
|
||||
{% if mode == 'training' %}
|
||||
<strong>{% trans 'Ausbildungsteam' %}:</strong>
|
||||
@@ -176,7 +178,7 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if registration_howto %}
|
||||
{% if registration_required and registration_howto %}
|
||||
<div class="panel-footer">
|
||||
<p>{{ registration_howto }}</p>
|
||||
</div>
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
{% endif %}{% if meeting_point and meeting_point != 'NONE' %}{% trans 'Treffpunkt' %}: {% if meeting_time %}{{ meeting_time|time:'G:i'|cut:':00' }} Uhr, {% endif %}{% if meeting_point == 'OTHER' %}{{ meeting_point_other }}{% else %}{{ event.get_meeting_point_display }}{% endif %}
|
||||
{% endif %}{% if pre_meeting_1 %}{% if pre_meeting_2 %}{% trans 'Vortreffen' %} 1: {{ pre_meeting_1|date:'l, d. F Y, G:i'|cut:':00' }} {% trans 'Uhr' %}, DAV {% trans 'Sektionszentrum' %}
|
||||
{% trans 'Vortreffen' %} 2: {{ pre_meeting_2|date:'l, d. F Y, G:i'|cut:':00' }} {% trans 'Uhr' %}, DAV {% trans 'Sektionszentrum' %}{% else %}{% trans 'Vortreffen' %}: {{ pre_meeting_1|date:'l, d. F Y, G:i'|cut:':00' }} {% trans 'Uhr' %}, DAV {% trans 'Sektionszentrum' %}{% endif %}
|
||||
{% endif %}{% if min_participants > 0 or max_participants > 0 %}{% trans 'Teilnehmerzahl' %}: {% if min_participants > 0 and max_participants > 0 %}{{ min_participants }} - {{ max_participants }} {% trans 'Teilnehmer' %}{% elif min_participants > 0 %}min. {{ min_participants }} {% trans 'Teilnehmer' %}{% else %}max. {{ max_participants }} {% trans 'Teilnehmer' %}{% endif %}
|
||||
{% endif %}{% if min_participants > 0 or max_participants > 0 %}{% trans 'Teilnehmerzahl' %}: {% if min_participants == max_participants %}{{ max_participants }} {% trans 'Teilnehmer' %}{% elif min_participants > 0 and max_participants > 0 %}{{ min_participants }} - {{ max_participants }} {% trans 'Teilnehmer' %}{% elif min_participants > 0 %}min. {{ min_participants }} {% trans 'Teilnehmer' %}{% else %}max. {{ max_participants }} {% trans 'Teilnehmer' %}{% endif %}
|
||||
{% endif %}{% if charge > 0 or additional_costs %}{% trans 'Kosten' %}: {% if charge > 0 %}{{ charge|floatformat:'-2' }} € {% trans 'Teilnahmegebühr' %}{% endif %}{% if additional_costs %}{% if charge > 0 %} {% trans 'zzgl.' %} {% endif %}{{ additional_costs }}{% endif %}
|
||||
{% endif %}{% if deadline %}{% trans 'Anmeldeschluss' %}: {{ deadline|date:'l, d. F Y' }}
|
||||
{% endif %}{% if registration_required and deadline %}{% trans 'Anmeldeschluss' %}: {{ deadline|date:'l, d. F Y' }}
|
||||
{% endif %}{% if trainer_2_fullname %}{% if mode == 'training' %}{% trans 'Ausbildungsteam' %}:{% else %}{% trans 'Team' %}:{% endif %} {{ trainer_firstname }} {{ trainer_familyname }}{% if trainer_email or trainer_phone %} ({% if trainer_email %}{{ trainer_email }}{% endif %}{% if trainer_email and trainer_phone %}, {% endif %}{% if trainer_phone %}{{ trainer_phone }}{% endif %}){% endif %}, {{ trainer_2_fullname }}{% if trainer_2_email or trainer_2_phone %} ({% if trainer_2_email %}{{ trainer_2_email }}{% endif %}{% if trainer_2_email and trainer_2_phone %}, {% endif %}{% if trainer_2_phone %}{{ trainer_2_phone }}{% endif %}){% endif %}{% if trainer_3_fullname %}, {{ trainer_3_fullname }}{% if trainer_3_email or trainer_3_phone %} ({% if trainer_3_email %}{{ trainer_3_email }}{% endif %}{% if trainer_3_email and trainer_3_phone %}, {% endif %}{% if trainer_3_phone %}{{ trainer_3_phone }}{% endif %}){% endif %}{% endif %}
|
||||
{% endif %}{% if trainer_familyname %}{% trans 'Leitung' %}: {{ trainer_firstname }} {{ trainer_familyname }}{% if trainer_email or trainer_phone %} ({% if trainer_email %}{{ trainer_email }}{% endif %}{% if trainer_email and trainer_phone %}, {% endif %}{% if trainer_phone %}{{ trainer_phone }}{% endif %}){% endif %}
|
||||
{% endif %}{% if registration_howto %}
|
||||
{% endif %}{% if registration_required and registration_howto %}
|
||||
{{ registration_howto }}
|
||||
{% endif %}
|
||||
@@ -4,35 +4,39 @@
|
||||
|
||||
{% block head-additional %}
|
||||
<script type="text/javascript">
|
||||
function add_no_registration_handler() {
|
||||
var e = $("#id_no_registration");
|
||||
if(e != null)
|
||||
e.change(function(){ no_registration_handler(); });
|
||||
function init_registration_required_handler() {
|
||||
var e = $("#id_registration_required");
|
||||
if(e != null) {
|
||||
e.change(function(){ registration_required_handler(); });
|
||||
if(!e.prop("checked")) {
|
||||
$("input[name=deadline_other]").prop("disabled", true);
|
||||
$("div[class~=registration_settings]").hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function no_registration_handler() {
|
||||
var e = $("#id_no_registration");
|
||||
function registration_required_handler() {
|
||||
var e = $("#id_registration_required");
|
||||
if(e != null)
|
||||
checked = e.prop("checked");
|
||||
else
|
||||
checked = false;
|
||||
checked = true;
|
||||
|
||||
// var elements = $("input[name=deadline]");
|
||||
//* elements.prop("disabled", checked);
|
||||
// $("input[name=deadline]").prop("disabled", !checked);
|
||||
$("input[name=deadline_other]").prop("disabled", !checked);
|
||||
|
||||
elements = $("input[name=deadline_other]");
|
||||
elements.prop("disabled", checked);
|
||||
|
||||
elements = $("div[class~=registration_settings]");
|
||||
if(checked)
|
||||
elements.slideUp();
|
||||
else
|
||||
var elements = $("div[class~=registration_settings]");
|
||||
if(checked) {
|
||||
elements.slideDown();
|
||||
} else {
|
||||
elements.slideUp();
|
||||
$("#id_min_participants").val("0");
|
||||
$("#id_max_participants").val("0");
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
add_no_registration_handler();
|
||||
no_registration_handler();
|
||||
init_registration_required_handler();
|
||||
});
|
||||
</script>
|
||||
{% endblock head-additional %}
|
||||
@@ -52,7 +56,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="col-sm-3">
|
||||
<label>{% trans 'Anmeldung' %}</label>
|
||||
{% bootstrap_field form.registration_required %}
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="row registration_settings">
|
||||
<div class="col-sm-12">
|
||||
{% bootstrap_field form.deadline %}
|
||||
|
||||
Reference in New Issue
Block a user