From ab8b7258a707287929b466c6b72c28467abf84f4 Mon Sep 17 00:00:00 2001 From: Maxime Bloch Date: Sat, 25 Jul 2020 02:46:33 +0200 Subject: [PATCH] add responsible person to event --- .../0004_event_responsible_person.py | 21 +++++++++++++++++++ events/models.py | 1 + events/templates/events/registrations.html | 2 ++ 3 files changed, 24 insertions(+) create mode 100644 events/migrations/0004_event_responsible_person.py diff --git a/events/migrations/0004_event_responsible_person.py b/events/migrations/0004_event_responsible_person.py new file mode 100644 index 0000000..97a007c --- /dev/null +++ b/events/migrations/0004_event_responsible_person.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0.8 on 2020-07-25 00:43 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('events', '0003_event_note'), + ] + + operations = [ + migrations.AddField( + model_name='event', + name='responsible_person', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/events/models.py b/events/models.py index c5b1e0d..89cdec7 100644 --- a/events/models.py +++ b/events/models.py @@ -14,6 +14,7 @@ class Event(models.Model): time = models.IntegerField(choices=TIME_SLOTS.items(), default=MORNING) capacity = models.IntegerField(default=6) note = models.TextField(max_length=1024, default="") + responsible_person = models.ForeignKey(CustomUser, null=True, on_delete=models.SET_NULL) def __str__(self): return f"{self.date} {self.TIME_SLOTS[self.time]}" diff --git a/events/templates/events/registrations.html b/events/templates/events/registrations.html index 9fce07f..f9719f1 100644 --- a/events/templates/events/registrations.html +++ b/events/templates/events/registrations.html @@ -1,5 +1,7 @@
{% csrf_token %} +

Verantwoordelijke: {{ event.responsible_person.username }}

+

{{ event.count_admitted }}/{{ event.capacity }} bevestigd

{% if event.count_interested %}