implement description for rooms, format descriptions on shift detail page
This commit is contained in:
parent
e18101e85a
commit
1562a1a689
|
@ -6,7 +6,7 @@ import sys
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Run administrative tasks."""
|
"""Run administrative tasks."""
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'shiftregister.settings')
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "shiftregister.settings")
|
||||||
try:
|
try:
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
|
@ -18,5 +18,5 @@ def main():
|
||||||
execute_from_command_line(sys.argv)
|
execute_from_command_line(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -7,7 +7,7 @@ admin.site.register(Room)
|
||||||
|
|
||||||
@admin.register(Shift)
|
@admin.register(Shift)
|
||||||
class ShiftAdmin(admin.ModelAdmin):
|
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):
|
def room_name(self, object):
|
||||||
return object.room.name
|
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)
|
name = models.CharField(max_length=200, primary_key=True)
|
||||||
required_helpers = models.IntegerField()
|
required_helpers = models.IntegerField()
|
||||||
meeting_location = models.TextField(default="Infopoint")
|
meeting_location = models.TextField(default="Infopoint")
|
||||||
|
description = models.TextField(blank=True, default="")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
|
@ -14,11 +14,20 @@
|
||||||
<div class="notification">Diese Schicht ist bereits besetzt.</div>
|
<div class="notification">Diese Schicht ist bereits besetzt.</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
<p>
|
||||||
<strong>Ort:</strong> <a href="{% url 'pages:view' 'map' %}#{{ shift.room.name|slugify }}">{{ shift.room.name }} 📍</a><br>
|
<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>Beginn:</strong> {{ shift.start_at }}<br>
|
||||||
<strong>Dauer:</strong> {{ shift.duration }}<br>
|
<strong>Dauer:</strong> {{ shift.duration }}<br>
|
||||||
<strong>Treffpunkt:</strong> {{ shift.room.meeting_location|linebreaksbr }}<br>
|
<strong>Treffpunkt:</strong> {{ shift.room.meeting_location|linebreaksbr }}
|
||||||
<em>{{ shift.description|linebreaksbr }}</em>
|
</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>
|
</div>
|
||||||
{% if can_register and not shift.deleted %}
|
{% if can_register and not shift.deleted %}
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
|
|
|
@ -51,6 +51,7 @@ def add_teammember(request, shiftid):
|
||||||
return redirect(p)
|
return redirect(p)
|
||||||
return redirect("signage:worklist")
|
return redirect("signage:worklist")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def remove_teammember(request, pk):
|
def remove_teammember(request, pk):
|
||||||
obj = get_object_or_404(TeamBackup, pk=pk)
|
obj = get_object_or_404(TeamBackup, pk=pk)
|
||||||
|
@ -58,6 +59,7 @@ def remove_teammember(request, pk):
|
||||||
obj.delete()
|
obj.delete()
|
||||||
return redirect("team:shift", sid)
|
return redirect("team:shift", sid)
|
||||||
|
|
||||||
|
|
||||||
def terminal(request):
|
def terminal(request):
|
||||||
help_wanted = Q(required_helpers__gt=F("reg_count")) | Q(required_helpers=0) & Q(
|
help_wanted = Q(required_helpers__gt=F("reg_count")) | Q(required_helpers=0) & Q(
|
||||||
room__required_helpers__gt=F("reg_count")
|
room__required_helpers__gt=F("reg_count")
|
||||||
|
|
|
@ -72,6 +72,7 @@ def shift_detail(request, pk):
|
||||||
return redirect("team:shift", pk=shift.pk)
|
return redirect("team:shift", pk=shift.pk)
|
||||||
# break potential cyclic imports
|
# break potential cyclic imports
|
||||||
from shiftregister.signage.forms import TeamBackupForm
|
from shiftregister.signage.forms import TeamBackupForm
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"shift": shift,
|
"shift": shift,
|
||||||
"add_helper_form": form,
|
"add_helper_form": form,
|
||||||
|
@ -166,6 +167,7 @@ def checkin(request, pk):
|
||||||
reg.save()
|
reg.save()
|
||||||
return redirect("team:shift", pk=reg.shift.pk)
|
return redirect("team:shift", pk=reg.shift.pk)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def delete_shiftregistration(request, pk):
|
def delete_shiftregistration(request, pk):
|
||||||
reg = get_object_or_404(ShiftRegistration, pk=pk)
|
reg = get_object_or_404(ShiftRegistration, pk=pk)
|
||||||
|
|
Loading…
Reference in New Issue