implement description for rooms, format descriptions on shift detail page

pull/1/head
Florian Sorg 3 years ago
parent e18101e85a
commit 1562a1a689

@ -6,7 +6,7 @@ import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'shiftregister.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "shiftregister.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
@ -18,5 +18,5 @@ def main():
execute_from_command_line(sys.argv)
if __name__ == '__main__':
if __name__ == "__main__":
main()

@ -7,7 +7,7 @@ admin.site.register(Room)
@admin.register(Shift)
class ShiftAdmin(admin.ModelAdmin):
list_display = ("room_name", "start_at", "free_slots", "deleted")
list_display = ("room_name", "description", "start_at", "free_slots", "deleted")
def room_name(self, object):
return object.room.name

@ -0,0 +1,18 @@
# Generated by Django 4.0.4 on 2022-05-21 16:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("app", "0010_room_meeting_location"),
]
operations = [
migrations.AddField(
model_name="room",
name="description",
field=models.TextField(blank=True, default=""),
),
]

@ -15,6 +15,7 @@ class Room(models.Model):
name = models.CharField(max_length=200, primary_key=True)
required_helpers = models.IntegerField()
meeting_location = models.TextField(default="Infopoint")
description = models.TextField(blank=True, default="")
def __str__(self):
return self.name

@ -14,11 +14,20 @@
<div class="notification">Diese Schicht ist bereits besetzt.</div>
{% endif %}
<div class="content">
<strong>Ort:</strong> <a href="{% url 'pages:view' 'map' %}#{{ shift.room.name|slugify }}">{{ shift.room.name }} 📍</a><br>
<strong>Beginn:</strong> {{ shift.start_at }}<br>
<strong>Dauer:</strong> {{ shift.duration }}<br>
<strong>Treffpunkt:</strong> {{ shift.room.meeting_location|linebreaksbr }}<br>
<em>{{ shift.description|linebreaksbr }}</em>
<p>
<strong>Ort:</strong> <a href="{% url 'pages:view' 'map' %}#{{ shift.room.name|slugify }}">{{ shift.room.name }} 📍</a><br>
<strong>Beginn:</strong> {{ shift.start_at }}<br>
<strong>Dauer:</strong> {{ shift.duration }}<br>
<strong>Treffpunkt:</strong> {{ shift.room.meeting_location|linebreaksbr }}
</p>
{% if shift.room.description %}
<strong>Beschreibung:</strong>
<p>{{ shift.room.description|linebreaksbr }}</p>
{% endif %}
{% if shift.description %}
<strong>Zusatzinfo:</strong><br>
<p>{{ shift.description|linebreaksbr }}</p>
{% endif %}
</div>
{% if can_register and not shift.deleted %}
<form action="" method="post">

@ -51,6 +51,7 @@ def add_teammember(request, shiftid):
return redirect(p)
return redirect("signage:worklist")
@login_required
def remove_teammember(request, pk):
obj = get_object_or_404(TeamBackup, pk=pk)
@ -58,6 +59,7 @@ def remove_teammember(request, pk):
obj.delete()
return redirect("team:shift", sid)
def terminal(request):
help_wanted = Q(required_helpers__gt=F("reg_count")) | Q(required_helpers=0) & Q(
room__required_helpers__gt=F("reg_count")

@ -72,6 +72,7 @@ def shift_detail(request, pk):
return redirect("team:shift", pk=shift.pk)
# break potential cyclic imports
from shiftregister.signage.forms import TeamBackupForm
context = {
"shift": shift,
"add_helper_form": form,
@ -166,6 +167,7 @@ def checkin(request, pk):
reg.save()
return redirect("team:shift", pk=reg.shift.pk)
@login_required
def delete_shiftregistration(request, pk):
reg = get_object_or_404(ShiftRegistration, pk=pk)

Loading…
Cancel
Save