add responsible person to event

This commit is contained in:
Maxime Bloch 2020-07-25 02:46:33 +02:00
parent 62b71a5df6
commit ab8b7258a7
3 changed files with 24 additions and 0 deletions

View file

@ -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),
),
]

View file

@ -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]}"

View file

@ -1,5 +1,7 @@
<form action="{% url 'events:register' event.id %}" method="post">
{% csrf_token %}
<p>Verantwoordelijke: {{ event.responsible_person.username }}</p>
<p>{{ event.count_admitted }}/{{ event.capacity }} bevestigd</p>
{% if event.count_interested %}