Merge pull request 'support for reduced fee' (#31) from heinzel into master
All checks were successful
buildbot/tox Build done.
All checks were successful
buildbot/tox Build done.
Reviewed-on: #31
This commit was merged in pull request #31.
This commit is contained in:
@@ -161,6 +161,12 @@
|
||||
<span title="{{ registration.get_info }}">
|
||||
{% bootstrap_icon 'info-sign' %}
|
||||
</span>
|
||||
{% if registration.apply_reduced_fee %}
|
||||
|
||||
<span class="text-info">
|
||||
<strong>%</strong>{% bootstrap_icon 'piggy-bank' %} (reduzierte Gebühr)
|
||||
</span>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% empty %}
|
||||
{% trans 'Keine Anmeldungen vorhanden' %}
|
||||
@@ -223,31 +229,29 @@
|
||||
{% endif %}
|
||||
{% if event.charge and participant.paid and has_permission_payment %}
|
||||
|
||||
<button name="action" value="revoke_payment"
|
||||
title="{% trans 'Geldeingang wurde bestätigt' %} - {% trans 'Bestätigung des Geldeingangs zurückziehen' %}"
|
||||
class="btn btn-link no-padding">
|
||||
<span class="text-success">{% bootstrap_icon 'piggy-bank' %}</span>
|
||||
</button>
|
||||
<span class="text-success"><strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong></span><button
|
||||
name="action" value="revoke_payment"
|
||||
title="{% trans 'Geldeingang wurde bestätigt' %} - {% trans 'Bestätigung des Geldeingangs zurückziehen' %}"
|
||||
class="btn btn-link no-padding"><span class="text-success">{% bootstrap_icon 'piggy-bank' %}</span></button>
|
||||
{% elif event.charge and participant.paid %}
|
||||
|
||||
<span class="text-success" title="{% trans 'Geldeingang bestätigt' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% elif event.charge and has_permission_payment %}
|
||||
|
||||
<button name="action" value="confirm_payment"
|
||||
title="{% trans 'Geldeingang bestätigen' %}"
|
||||
class="btn btn-link no-padding">
|
||||
<span class="text-danger">{% bootstrap_icon 'piggy-bank' %}</span>
|
||||
</button>
|
||||
<span class="text-danger"><strong>{% if participant.apply_reduced_fee %}%{% elif participant.created_at|date:'U' < '1608764400' %}? {% else %} {% endif %}</strong></span><button
|
||||
name="action" value="confirm_payment"
|
||||
title="{% trans 'Geldeingang bestätigen' %}"
|
||||
class="btn btn-link no-padding"><span class="text-danger">{% bootstrap_icon 'piggy-bank' %}</span></button>
|
||||
{% elif event.charge %}
|
||||
|
||||
<span class="text-danger" title="{% trans 'Geldeingang unbestätigt' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong>{% if participant.apply_reduced_fee %}%{% elif participant.created_at|date:'U' < '1608764400' %}? {% else %} {% endif %}</strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="hidden" title="{% trans 'Keine Teilnehmergebühr gefordert' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong> </strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</form>
|
||||
@@ -377,12 +381,12 @@
|
||||
{% if event.charge and participant.paid %}
|
||||
|
||||
<span class="text-success" title="{% trans 'Geldeingang bestätigt' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% elif event.charge %}
|
||||
|
||||
<span class="text-danger" title="{% trans 'Geldeingang unbestätigt' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
|
||||
@@ -28,6 +28,14 @@
|
||||
{% bootstrap_field form.phone_number %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
{% bootstrap_field form.year_of_birth %}
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
{% bootstrap_field form.apply_reduced_fee %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
{% bootstrap_field form.dav_number %}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<th>{% trans 'Nachname' %}</th>
|
||||
<th>{% trans 'Vorname' %}</th>
|
||||
<th>{% trans 'Mitgliedsnummer' %}</th>
|
||||
<th>{% trans 'Teilnehmergebühr' %}</th>
|
||||
<th>{% trans 'Teilnahmegebühr' %}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><input type="text" placeholder="{% trans 'Filter' %}" /></th>
|
||||
@@ -32,7 +32,7 @@
|
||||
<th><input type="text" placeholder="{% trans 'Filter' %}" /></th>
|
||||
<th><input type="text" placeholder="{% trans 'Filter' %}" /></th>
|
||||
<th><input type="text" placeholder="{% trans 'Filter' %}" /></th>
|
||||
<th><input type="text" placeholder="{% trans 'Filter' %} ({% trans 'Grün' %}/{% trans 'Rot' %})" /></th>
|
||||
<th><input type="text" placeholder="{% trans 'Filter' %} ({% trans 'Grün' %}/{% trans 'Rot' %}/{% trans 'Grau' %}/%)" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -62,7 +62,7 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
<td data-order="{{ participant.paid }} {{ event.charge|floatformat:'-2' }}"
|
||||
data-search="{% if participant.paid %}{% trans 'Grün' %}{% else %}{% trans 'Rot' %}{% endif %} {{ event.charge|floatformat:'-2' }}">
|
||||
data-search="{% if not event.charge %}{% trans 'Grau' %}{% elif participant.paid %}{% trans 'Grün' %}{% else %}{% trans 'Rot' %}{% endif %} {% if participant.apply_reduced_fee %}%{% endif %} {{ event.charge|floatformat:'-2' }}">
|
||||
<div class="pull-right">
|
||||
<a title="{{ participant.email_address}}" href="mailto:{{ participant.email_address}}">{% bootstrap_icon 'envelope' %}</a>
|
||||
<span class="text-info" title="{{ participant.get_info }}
|
||||
@@ -72,24 +72,22 @@
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="id" value="{{ participant.id }}">
|
||||
{% if event.charge and participant.paid %}
|
||||
<button name="action" value="revoke_payment"
|
||||
title="{% trans 'Geldeingang wurde bestätigt' %} - {% trans 'Bestätigung des Geldeingangs zurückziehen' %}"
|
||||
class="btn btn-link no-padding">
|
||||
<span class="text-success">{% bootstrap_icon 'piggy-bank' %}</span>
|
||||
</button>
|
||||
<span class="text-success"><strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong></span><button
|
||||
name="action" value="revoke_payment"
|
||||
title="{% trans 'Geldeingang wurde bestätigt' %} - {% trans 'Bestätigung des Geldeingangs zurückziehen' %}"
|
||||
class="btn btn-link no-padding"><span class="text-success">{% bootstrap_icon 'piggy-bank' %}</span></button>
|
||||
|
||||
({{ event.charge|floatformat:'-2' }} €)
|
||||
({{ event.charge|floatformat:'-2' }}{% if participant.apply_reduced_fee %} / 2{% endif %} €)
|
||||
{% elif event.charge %}
|
||||
<button name="action" value="confirm_payment"
|
||||
title="{% trans 'Geldeingang bestätigen' %}"
|
||||
class="btn btn-link no-padding">
|
||||
<span class="text-danger">{% bootstrap_icon 'piggy-bank' %}</span>
|
||||
</button>
|
||||
<span class="text-danger"><strong>{% if participant.apply_reduced_fee %}%{% elif participant.created_at|date:'U' < '1608764400' %}? {% else %} {% endif %}</strong></span><button
|
||||
name="action" value="confirm_payment"
|
||||
title="{% trans 'Geldeingang bestätigen' %}"
|
||||
class="btn btn-link no-padding"><span class="text-danger">{% bootstrap_icon 'piggy-bank' %}</span></button>
|
||||
|
||||
({{ event.charge|floatformat:'-2' }} €)
|
||||
({{ event.charge|floatformat:'-2' }}{% if participant.apply_reduced_fee %} / 2{% endif %} €)
|
||||
{% else %}
|
||||
<span class="text-muted" title="{% trans 'Keine Teilnehmergebühr gefordert' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong> </strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
27
dav_events/migrations/0037_auto_20201209_1327.py
Normal file
27
dav_events/migrations/0037_auto_20201209_1327.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.29 on 2020-12-09 12:27
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dav_events', '0036_trashedparticipant'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='participant',
|
||||
name='year_of_birth',
|
||||
field=models.IntegerField(default=1870, verbose_name='Geburtsjahr'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='trashedparticipant',
|
||||
name='year_of_birth',
|
||||
field=models.IntegerField(default=1870, verbose_name='Geburtsjahr'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
25
dav_events/migrations/0038_auto_20201209_1542.py
Normal file
25
dav_events/migrations/0038_auto_20201209_1542.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.29 on 2020-12-09 14:42
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dav_events', '0037_auto_20201209_1327'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='participant',
|
||||
name='apply_reduced_fee',
|
||||
field=models.BooleanField(default=False, verbose_name='Antrag auf reduzierte Teilnahmegebühr'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='trashedparticipant',
|
||||
name='apply_reduced_fee',
|
||||
field=models.BooleanField(default=False, verbose_name='Antrag auf reduzierte Teilnahmegebühr'),
|
||||
),
|
||||
]
|
||||
@@ -28,6 +28,15 @@ class AbstractParticipant(models.Model):
|
||||
email_address = models.EmailField(verbose_name=_('E-Mail-Adresse'))
|
||||
phone_number = models.CharField(max_length=254,
|
||||
verbose_name=_('Telefonnummer'))
|
||||
year_of_birth = models.IntegerField(verbose_name=_('Geburtsjahr'),
|
||||
help_text=_('Vierstellige Jahreszahl'))
|
||||
apply_reduced_fee = models.BooleanField(default=False,
|
||||
verbose_name=_('Antrag auf reduzierte Teilnahmegebühr'),
|
||||
help_text=_('Für Jugendliche und Junioren'
|
||||
' (bis zum vollendeten 25. Lebensjahr),'
|
||||
' sowie Mitglieder mit geringen finanziellen Mitteln'
|
||||
' (Nachweis durch "Karlsruher Pass"),'
|
||||
' wird die Teilnahmegebühr auf 50% ermäßigt.'))
|
||||
dav_member = models.BooleanField(default=True,
|
||||
verbose_name=_('DAV Mitglied'),
|
||||
help_text=_('In Ausnahmefällen nehmen wir auch Nichtmitglieder mit.'))
|
||||
@@ -48,6 +57,11 @@ class AbstractParticipant(models.Model):
|
||||
|
||||
purge_at = models.DateTimeField()
|
||||
|
||||
def approx_age(self):
|
||||
now = datetime.datetime.now()
|
||||
year_now = now.year
|
||||
return year_now - self.year_of_birth
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
@@ -62,6 +76,8 @@ class AbstractParticipant(models.Model):
|
||||
{address}, {postal_code} {city}
|
||||
|
||||
DAV Mitglied: {dav_info}
|
||||
Jahrgang: {year_of_birth} (ungefähres Alter: {approx_age})
|
||||
Antrag auf reduzierte Teilnehmergebühr: {apply_reduced_fee_yesno}
|
||||
|
||||
Notfallkontakt:
|
||||
{emergency_contact}
|
||||
@@ -74,12 +90,20 @@ class AbstractParticipant(models.Model):
|
||||
else:
|
||||
dav_info = self.dav_number
|
||||
|
||||
if self.apply_reduced_fee:
|
||||
apply_reduced_fee_yesno = _('Ja')
|
||||
else:
|
||||
apply_reduced_fee_yesno = _('Nein')
|
||||
|
||||
return text.format(
|
||||
fullname=self.get_full_name(),
|
||||
address=self.address,
|
||||
postal_code=self.postal_code,
|
||||
city=self.city,
|
||||
dav_info=dav_info,
|
||||
year_of_birth=self.year_of_birth,
|
||||
approx_age=self.approx_age(),
|
||||
apply_reduced_fee_yesno=apply_reduced_fee_yesno,
|
||||
emergency_contact=self.emergency_contact,
|
||||
note=self.note,
|
||||
)
|
||||
@@ -87,7 +111,8 @@ class AbstractParticipant(models.Model):
|
||||
def get_data_dict(self):
|
||||
data = {}
|
||||
for field in self._meta.fields:
|
||||
data[field.name] = getattr(self, field.name)
|
||||
if not field.primary_key:
|
||||
data[field.name] = getattr(self, field.name)
|
||||
return data
|
||||
|
||||
def clean(self):
|
||||
|
||||
@@ -295,6 +295,12 @@ Das musst du selbst (per E-Mail oder telefonisch) machen.
|
||||
<span title="{{ registration.get_info }}">
|
||||
{% bootstrap_icon 'info-sign' %}
|
||||
</span>
|
||||
{% if registration.apply_reduced_fee %}
|
||||
|
||||
<span class="text-info">
|
||||
<strong>%</strong>{% bootstrap_icon 'piggy-bank' %} (reduzierte Gebühr)
|
||||
</span>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% empty %}
|
||||
{% trans 'Keine unbearbeiteten Anmeldungen vorhanden' %}
|
||||
@@ -386,31 +392,29 @@ Wichtig: das System verschickt keine Bestätigung an dich oder den neuen Teilneh
|
||||
{% endif %}
|
||||
{% if event.charge and participant.paid and has_permission_payment %}
|
||||
|
||||
<button name="action" value="revoke_payment"
|
||||
title="{% trans 'Geldeingang wurde bestätigt' %} - {% trans 'Bestätigung des Geldeingangs zurückziehen' %}"
|
||||
class="btn btn-link no-padding">
|
||||
<span class="text-success">{% bootstrap_icon 'piggy-bank' %}</span>
|
||||
</button>
|
||||
<span class="text-success"><strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong></span><button
|
||||
name="action" value="revoke_payment"
|
||||
title="{% trans 'Geldeingang wurde bestätigt' %} - {% trans 'Bestätigung des Geldeingangs zurückziehen' %}"
|
||||
class="btn btn-link no-padding"><span class="text-success">{% bootstrap_icon 'piggy-bank' %}</span></button>
|
||||
{% elif event.charge and participant.paid %}
|
||||
|
||||
<span class="text-success" title="{% trans 'Geldeingang bestätigt' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% elif event.charge and has_permission_payment %}
|
||||
|
||||
<button name="action" value="confirm_payment"
|
||||
title="{% trans 'Geldeingang bestätigen' %}"
|
||||
class="btn btn-link no-padding">
|
||||
<span class="text-danger">{% bootstrap_icon 'piggy-bank' %}</span>
|
||||
</button>
|
||||
<span class="text-danger"><strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong></span><button
|
||||
name="action" value="confirm_payment"
|
||||
title="{% trans 'Geldeingang bestätigen' %}"
|
||||
class="btn btn-link no-padding"><span class="text-danger">{% bootstrap_icon 'piggy-bank' %}</span></button>
|
||||
{% elif event.charge %}
|
||||
|
||||
<span class="text-danger" title="{% trans 'Geldeingang unbestätigt' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="hidden" title="{% trans 'Keine Teilnehmergebühr gefordert' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</form>
|
||||
@@ -577,12 +581,12 @@ von Position {{ participant.position }} der Teilnehmerliste entfernt.
|
||||
{% if event.charge and participant.paid %}
|
||||
|
||||
<span class="text-success" title="{% trans 'Geldeingang bestätigt' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% elif event.charge %}
|
||||
|
||||
<span class="text-danger" title="{% trans 'Geldeingang unbestätigt' %}">
|
||||
{% bootstrap_icon 'piggy-bank' %}
|
||||
<strong>{% if participant.apply_reduced_fee %}%{% else %} {% endif %}</strong>{% bootstrap_icon 'piggy-bank' %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
|
||||
@@ -28,6 +28,14 @@
|
||||
{% bootstrap_field form.phone_number %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
{% bootstrap_field form.year_of_birth %}
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
{% bootstrap_field form.apply_reduced_fee %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
{% bootstrap_field form.dav_number %}
|
||||
|
||||
@@ -284,6 +284,8 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
|
||||
'postal_code': registration.postal_code,
|
||||
'city': registration.city,
|
||||
'email_address': registration.email_address,
|
||||
'year_of_birth': registration.year_of_birth,
|
||||
'apply_reduced_fee': registration.apply_reduced_fee,
|
||||
'phone_number': registration.phone_number,
|
||||
'dav_member': registration.dav_member,
|
||||
'dav_number': registration.dav_number,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
import logging
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||
@@ -24,6 +25,31 @@ class RegistrationForm(forms.ModelForm):
|
||||
'experience': forms.Textarea(attrs={'rows': 5}),
|
||||
'note': forms.Textarea(attrs={'rows': 5}),
|
||||
}
|
||||
labels = {
|
||||
'apply_reduced_fee': _('Ich bin noch keine 25 Jahre alt oder besitze einen "Karlsruher Pass".'),
|
||||
}
|
||||
|
||||
def clean_year_of_birth(self):
|
||||
now = datetime.datetime.now()
|
||||
year_now = now.year
|
||||
max_age = 100
|
||||
val = self.cleaned_data.get('year_of_birth')
|
||||
if val > year_now:
|
||||
raise forms.ValidationError(
|
||||
ugettext(u'Dein Geburtsjahr liegt in der Zukunft?'
|
||||
u' Das finden wir gut,'
|
||||
u' aber bitte melde dich besser mal per E-Mail bei uns.'),
|
||||
code='to_young',
|
||||
)
|
||||
elif val < (year_now - max_age):
|
||||
raise forms.ValidationError(
|
||||
ugettext(u'Du bist schon über %(max_age)d Jahre alt?'
|
||||
u' Das finden wir gut,'
|
||||
u' aber bitte melde dich besser mal per E-Mail bei uns.'),
|
||||
params={'max_age': max_age},
|
||||
code='to_old',
|
||||
)
|
||||
return val
|
||||
|
||||
def clean_experience(self):
|
||||
val = self.cleaned_data.get('experience')
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.29 on 2020-12-09 09:20
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dav_registration', '0008_auto_20201208_1906'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='registration',
|
||||
name='year_of_birth',
|
||||
field=models.IntegerField(default=1870, help_text='Manchmal müssen wir wissen, wie alt unsere Teilnehmer sind. Darum brauchen wir die vierstellige Jahreszahl, des Jahres in dem du geboren bist (zb. 1991).', verbose_name='Geburtsjahr'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.29 on 2020-12-09 14:16
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dav_registration', '0009_registration_year_of_birth'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='registration',
|
||||
name='apply_reduced_fee',
|
||||
field=models.BooleanField(default=False, help_text='Für Jugendliche und Junioren (bis zum vollendeten 25. Lebensjahr), sowie Mitglieder mit geringen finanziellen Mitteln (Nachweis durch "Karlsruher Pass"), wird die Teilnahmegebühr auf 50% ermäßigt.', verbose_name='Antrag auf reduzierte Teilnahmegebühr'),
|
||||
),
|
||||
]
|
||||
@@ -40,6 +40,20 @@ class Registration(models.Model):
|
||||
phone_number = models.CharField(max_length=254,
|
||||
verbose_name=_('Telefonnummer'),
|
||||
help_text=_('Idealerweise eine Mobilfunk-Nummer'))
|
||||
|
||||
year_of_birth = models.IntegerField(verbose_name=_('Geburtsjahr'),
|
||||
help_text=_('Manchmal müssen wir wissen, wie alt unsere Teilnehmer sind.'
|
||||
' Darum brauchen wir die vierstellige Jahreszahl,'
|
||||
' des Jahres in dem du geboren bist (zb. 1991).'))
|
||||
|
||||
apply_reduced_fee = models.BooleanField(default=False,
|
||||
verbose_name=_('Antrag auf reduzierte Teilnahmegebühr'),
|
||||
help_text=_('Für Jugendliche und Junioren'
|
||||
' (bis zum vollendeten 25. Lebensjahr),'
|
||||
' sowie Mitglieder mit geringen finanziellen Mitteln'
|
||||
' (Nachweis durch "Karlsruher Pass"),'
|
||||
' wird die Teilnahmegebühr auf 50% ermäßigt.'))
|
||||
|
||||
dav_member = models.BooleanField(default=True,
|
||||
verbose_name=_('DAV Mitglied'))
|
||||
dav_number = models.CharField(max_length=62,
|
||||
@@ -74,6 +88,11 @@ class Registration(models.Model):
|
||||
|
||||
answered_obsolete = models.BooleanField(default=False, verbose_name=_('Durch Tourleitung beantwortet'))
|
||||
|
||||
def approx_age(self):
|
||||
now = datetime.datetime.now()
|
||||
year_now = now.year
|
||||
return year_now - self.year_of_birth
|
||||
|
||||
@staticmethod
|
||||
def pk2hexstr(pk):
|
||||
return hex(pk * 113)[2:] # 113 has no meaning, but it produce nice looking hex codes.
|
||||
@@ -113,6 +132,8 @@ class Registration(models.Model):
|
||||
{address}, {postal_code} {city}
|
||||
|
||||
DAV Mitglied: {dav_info}
|
||||
Jahrgang: {year_of_birth} (ungefähres Alter: {approx_age})
|
||||
Antrag auf reduzierte Teilnehmergebühr: {apply_reduced_fee_yesno}
|
||||
|
||||
Erfahrung:
|
||||
{experience}
|
||||
@@ -125,12 +146,20 @@ Anmerkung:
|
||||
else:
|
||||
dav_info = self.dav_number
|
||||
|
||||
if self.apply_reduced_fee:
|
||||
apply_reduced_fee_yesno = _('Ja')
|
||||
else:
|
||||
apply_reduced_fee_yesno = _('Nein')
|
||||
|
||||
return text.format(
|
||||
fullname=self.get_full_name(),
|
||||
address=self.address,
|
||||
postal_code=self.postal_code,
|
||||
city=self.city,
|
||||
dav_info=dav_info,
|
||||
year_of_birth=self.year_of_birth,
|
||||
approx_age=self.approx_age(),
|
||||
apply_reduced_fee_yesno=apply_reduced_fee_yesno,
|
||||
experience=self.experience,
|
||||
note=self.note,
|
||||
)
|
||||
|
||||
@@ -22,6 +22,8 @@ Personendaten
|
||||
{{ registration.postal_code }} {{ registration.city }}
|
||||
Telefon: {{ registration.phone_number }}
|
||||
E-Mail: {{ registration.email_address }}
|
||||
Jahrgang: {{ registration.year_of_birth }}
|
||||
Antrag auf reduzierte Teilnahmegebühr: {% if registration.apply_reduced_fee %}Ja{% else %}Nein{% endif %}
|
||||
{% if registration.dav_member %}DAV Mitgliedsnummer: {{ registration.dav_number }}{% else %}DAV Mitglied: Nein{% endif %}
|
||||
|
||||
Notfall-Kontakt
|
||||
|
||||
@@ -12,6 +12,7 @@ Teilnehmer*in:
|
||||
{{ registration.phone_number }}
|
||||
{{ registration.email_address }}
|
||||
{% if registration.dav_member %}{{ registration.dav_number }}{% else %}Nicht DAV Mitglied{% endif %}
|
||||
Antrag auf reduzierte Teilnahmegebühr: {% if registration.apply_reduced_fee %}Ja{% else %}Nein{% endif %}
|
||||
|
||||
Notfall-Kontakt:
|
||||
{% if registration.emergency_contact %}{{ registration.emergency_contact }}{% else %}-{% endif %}
|
||||
@@ -19,6 +20,8 @@ Notfall-Kontakt:
|
||||
Erfahrung:
|
||||
{% if registration.experience %}{{ registration.experience }}{% else %}-{% endif %}
|
||||
|
||||
Jahrgang: {{ registration.year_of_birth }} (ungefähres Alter: {{ registration.approx_age }})
|
||||
|
||||
Anmerkung:
|
||||
{% if registration.note %}{{ registration.note }}{% else %}-{% endif %}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<div class="pull-right" style="margin-left: 2em;">
|
||||
<a role="button" id="controlCollapseDetails{{ event.id }}" data-toggle="collapse"
|
||||
<a role="button" id="controlChevronCollapseDetails{{ event.id }}" data-toggle="collapse"
|
||||
href="#collapseDetails{{ event.id }}"
|
||||
aria-expanded="false" aria-controls="collapseDetails{{ event.id }}">
|
||||
<span title="{% trans 'Details aufklappen' %}" class="glyphicon glyphicon-chevron-down"></span>
|
||||
@@ -46,9 +46,13 @@
|
||||
{% endwith %}
|
||||
</div>
|
||||
<div>
|
||||
<strong>
|
||||
{{ event.get_number }} - {{ event.title }}
|
||||
</strong>
|
||||
<strong><span class="panel-title">
|
||||
<a role="button" id="controlCollapseDetails{{ event.id }}" data-toggle="collapse"
|
||||
href="#collapseDetails{{ event.id }}"
|
||||
aria-expanded="false" aria-controls="collapseDetails{{ event.id }}">
|
||||
{{ event.get_number }} - {{ event.title }}
|
||||
</a>
|
||||
</span></strong>
|
||||
<p>
|
||||
{{ event.get_formated_date }}
|
||||
{% if event.get_alt_formated_date %}
|
||||
@@ -81,12 +85,12 @@
|
||||
</div>
|
||||
<script>
|
||||
$("#collapseDetails{{ event.id }}").on("shown.bs.collapse", function() {
|
||||
icon = $("#controlCollapseDetails{{ event.id }}").find(".glyphicon")
|
||||
icon = $("#controlChevronCollapseDetails{{ event.id }}").find(".glyphicon")
|
||||
icon.removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up");
|
||||
icon.attr("title", "{% trans 'Details verbergen' %}");
|
||||
});
|
||||
$("#collapseDetails{{ event.id }}").on("hidden.bs.collapse", function() {
|
||||
icon = $("#controlCollapseDetails{{ event.id }}").find(".glyphicon")
|
||||
icon = $("#controlChevronCollapseDetails{{ event.id }}").find(".glyphicon")
|
||||
icon.removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down");
|
||||
icon.attr("title", "{% trans 'Details aufklappen' %}");
|
||||
});
|
||||
|
||||
@@ -32,8 +32,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
function year_of_birth_handler() {
|
||||
var junior_age = 25
|
||||
var year_now = new Date().getFullYear()
|
||||
var year_of_birth = parseInt($("#id_year_of_birth").val());
|
||||
if(year_of_birth > (year_now - junior_age)) {
|
||||
$("#id_apply_reduced_fee").prop('checked', true);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
init_not_dav_member_handler();
|
||||
var e = $("#id_year_of_birth");
|
||||
e.change(function(){ year_of_birth_handler(); });
|
||||
});
|
||||
</script>
|
||||
{% endblock head-additional %}
|
||||
@@ -74,10 +85,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="col-sm-3">
|
||||
{% bootstrap_field form.postal_code %}
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="col-sm-9">
|
||||
{% bootstrap_field form.city %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -89,11 +100,21 @@
|
||||
{% bootstrap_field form.phone_number %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
{% bootstrap_field form.year_of_birth %}
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<strong>Antrag auf reduzierte Teilnahmegebühr</strong>
|
||||
{% bootstrap_field form.apply_reduced_fee %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
{% bootstrap_field form.dav_number %}
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<strong>Nichtmitglieder</strong>
|
||||
{% bootstrap_field form.not_dav_member %}
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
from django.utils import timezone
|
||||
from ..models import Registration
|
||||
|
||||
THIS_YEAR = timezone.now().year
|
||||
|
||||
|
||||
class RegistrationMixin(object):
|
||||
def create_registration(self, data):
|
||||
|
||||
@@ -10,7 +10,7 @@ from django.utils.translation import get_language
|
||||
from dav_base.tests.generic import EmailTestMixin
|
||||
from dav_events.tests.generic import EventMixin
|
||||
|
||||
from .generic import RegistrationMixin
|
||||
from .generic import THIS_YEAR, RegistrationMixin
|
||||
|
||||
MAIL_SELF_TEMPLATE = """Hallo {participant_full_name},
|
||||
|
||||
@@ -36,6 +36,8 @@ Here
|
||||
1 Karlsruhe
|
||||
Telefon: 12
|
||||
E-Mail: {participant_email}
|
||||
Jahrgang: {year_of_birth}
|
||||
Antrag auf reduzierte Teilnahmegebühr: {apply_reduced_fee_yesno}
|
||||
DAV Mitgliedsnummer: 0
|
||||
|
||||
Notfall-Kontakt
|
||||
@@ -70,6 +72,7 @@ Here, 1 Karlsruhe
|
||||
12
|
||||
{participant_email}
|
||||
0
|
||||
Antrag auf reduzierte Teilnahmegebühr: {apply_reduced_fee_yesno}
|
||||
|
||||
Notfall-Kontakt:
|
||||
-
|
||||
@@ -77,6 +80,8 @@ Notfall-Kontakt:
|
||||
Erfahrung:
|
||||
-
|
||||
|
||||
Jahrgang: {year_of_birth} (ungefähres Alter: {approx_age})
|
||||
|
||||
Anmerkung:
|
||||
-
|
||||
|
||||
@@ -112,6 +117,7 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '12',
|
||||
'email_address': 'participant@localhost',
|
||||
'year_of_birth': THIS_YEAR - 10,
|
||||
'dav_number': '0',
|
||||
}
|
||||
registration = self.create_registration(registration_data)
|
||||
@@ -131,6 +137,8 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
body = MAIL_SELF_TEMPLATE.format(
|
||||
participant_full_name=registration.get_full_name(),
|
||||
participant_email=registration.email_address,
|
||||
year_of_birth=registration.year_of_birth,
|
||||
apply_reduced_fee_yesno='Nein',
|
||||
event_number=event.get_number(),
|
||||
event_title=event.title,
|
||||
event_formated_date=event.get_formated_date(),
|
||||
@@ -155,6 +163,8 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
'postal_code': '76131',
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '+49 721 1234567890 AB (Büro)',
|
||||
'year_of_birth': 1976,
|
||||
'apply_reduced_fee': True,
|
||||
'dav_member': False,
|
||||
'dav_number': '131/00/007*12345',
|
||||
'emergency_contact': 'Call 911!',
|
||||
@@ -173,6 +183,8 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
search += '{} {}\n'.format(registration_data['postal_code'], registration_data['city'])
|
||||
search += 'Telefon: {}\n'.format(registration_data['phone_number'])
|
||||
search += 'E-Mail: {}\n'.format(registration_data['email_address'])
|
||||
search += 'Jahrgang: {}\n'.format(registration_data['year_of_birth'])
|
||||
search += 'Antrag auf reduzierte Teilnahmegebühr: Ja\n'
|
||||
search += 'DAV Mitglied: Nein\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
@@ -215,6 +227,7 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '12',
|
||||
'email_address': 'participant@localhost',
|
||||
'year_of_birth': THIS_YEAR - 86,
|
||||
'dav_number': '0',
|
||||
}
|
||||
registration = self.create_registration(registration_data)
|
||||
@@ -235,6 +248,9 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
body = MAIL_TRAINER_TEMPLATE.format(
|
||||
participant_full_name=registration.get_full_name(),
|
||||
participant_email=registration.email_address,
|
||||
year_of_birth=registration.year_of_birth,
|
||||
approx_age=registration.approx_age(),
|
||||
apply_reduced_fee_yesno='Nein',
|
||||
event_number=event.get_number(),
|
||||
event_title=event.title,
|
||||
event_formated_date=event.get_formated_date(),
|
||||
@@ -258,6 +274,8 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
'postal_code': '76131',
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '+49 721 1234567890 AB (Büro)',
|
||||
'year_of_birth': THIS_YEAR,
|
||||
'apply_reduced_fee': True,
|
||||
'dav_member': False,
|
||||
'dav_number': '131/00/007*12345',
|
||||
'emergency_contact': 'Call 911!',
|
||||
@@ -277,8 +295,8 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
search += '\n'
|
||||
search += registration_data['email_address']
|
||||
search += '\n'
|
||||
search += 'Nicht DAV Mitglied'
|
||||
search += '\n'
|
||||
search += 'Nicht DAV Mitglied\n'
|
||||
search += 'Antrag auf reduzierte Teilnahmegebühr: Ja\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
@@ -293,6 +311,12 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
search += '\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
search += 'Jahrgang: '
|
||||
search += str(registration_data['year_of_birth'])
|
||||
search += ' (ungefähres Alter: 0)\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
search += 'Anmerkung:\n'
|
||||
search += registration_data['note']
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.test import TestCase
|
||||
|
||||
from dav_events.tests.generic import EventMixin
|
||||
|
||||
from .generic import RegistrationMixin
|
||||
from .generic import THIS_YEAR, RegistrationMixin
|
||||
|
||||
|
||||
class RegistrationTestCase(EventMixin, RegistrationMixin, TestCase):
|
||||
@@ -32,6 +32,7 @@ class RegistrationTestCase(EventMixin, RegistrationMixin, TestCase):
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '12',
|
||||
'email_address': 'participant@localhost',
|
||||
'year_of_birth': THIS_YEAR,
|
||||
}
|
||||
dav_numbers = ['0', '12345', '131/00/12345']
|
||||
for n in dav_numbers:
|
||||
@@ -50,6 +51,7 @@ class RegistrationTestCase(EventMixin, RegistrationMixin, TestCase):
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '12',
|
||||
'email_address': 'participant@localhost',
|
||||
'year_of_birth': THIS_YEAR,
|
||||
}
|
||||
with self.assertRaisesMessage(ValidationError,
|
||||
'Wenn du DAV Mitglied bist, brauchen wir deine Mitgliedsnummer.'):
|
||||
@@ -71,6 +73,7 @@ class RegistrationTestCase(EventMixin, RegistrationMixin, TestCase):
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '12',
|
||||
'email_address': 'participant@localhost',
|
||||
'year_of_birth': THIS_YEAR,
|
||||
}
|
||||
dav_numbers = ['Nein', '-', '13100123456789']
|
||||
for n in dav_numbers:
|
||||
@@ -93,6 +96,7 @@ class RegistrationTestCase(EventMixin, RegistrationMixin, TestCase):
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '12',
|
||||
'email_address': 'participant@localhost',
|
||||
'year_of_birth': THIS_YEAR,
|
||||
'dav_member': False,
|
||||
}
|
||||
self.create_registration(registration_data)
|
||||
|
||||
@@ -9,7 +9,7 @@ from dav_events.tests.generic import EventMixin
|
||||
from ..models import Registration
|
||||
from ..utils import purge_registrations
|
||||
|
||||
from .generic import RegistrationMixin
|
||||
from .generic import THIS_YEAR, RegistrationMixin
|
||||
|
||||
|
||||
class UtilsTestCase(RegistrationMixin, EventMixin, TestCase):
|
||||
@@ -37,6 +37,7 @@ class UtilsTestCase(RegistrationMixin, EventMixin, TestCase):
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '555 5555',
|
||||
'email_address': 'participant@localhost',
|
||||
'year_of_birth': THIS_YEAR - 44,
|
||||
'dav_number': '1',
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user