This commit is contained in:
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,
|
||||
),
|
||||
]
|
||||
@@ -28,6 +28,7 @@ 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'))
|
||||
dav_member = models.BooleanField(default=True,
|
||||
verbose_name=_('DAV Mitglied'),
|
||||
help_text=_('In Ausnahmefällen nehmen wir auch Nichtmitglieder mit.'))
|
||||
@@ -48,6 +49,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 +68,7 @@ class AbstractParticipant(models.Model):
|
||||
{address}, {postal_code} {city}
|
||||
|
||||
DAV Mitglied: {dav_info}
|
||||
Jahrgang: {year_of_birth} (ungefähres Alter: {approx_age})
|
||||
|
||||
Notfallkontakt:
|
||||
{emergency_contact}
|
||||
@@ -80,6 +87,8 @@ class AbstractParticipant(models.Model):
|
||||
postal_code=self.postal_code,
|
||||
city=self.city,
|
||||
dav_info=dav_info,
|
||||
year_of_birth=self.year_of_birth,
|
||||
approx_age=self.approx_age(),
|
||||
emergency_contact=self.emergency_contact,
|
||||
note=self.note,
|
||||
)
|
||||
|
||||
@@ -21,12 +21,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-4">
|
||||
{% bootstrap_field form.email_address %}
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-4">
|
||||
{% bootstrap_field form.phone_number %}
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
{% bootstrap_field form.year_of_birth %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
|
||||
@@ -284,6 +284,7 @@ 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,
|
||||
'phone_number': registration.phone_number,
|
||||
'dav_member': registration.dav_member,
|
||||
'dav_number': registration.dav_number,
|
||||
|
||||
Reference in New Issue
Block a user