diff --git a/manage.py b/manage.py index f521389..34c8a7e 100755 --- a/manage.py +++ b/manage.py @@ -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() diff --git a/shiftregister/app/admin.py b/shiftregister/app/admin.py index 564b7ee..a0a3037 100644 --- a/shiftregister/app/admin.py +++ b/shiftregister/app/admin.py @@ -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 diff --git a/shiftregister/app/migrations/0011_room_description.py b/shiftregister/app/migrations/0011_room_description.py new file mode 100644 index 0000000..e6abba8 --- /dev/null +++ b/shiftregister/app/migrations/0011_room_description.py @@ -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=""), + ), + ] diff --git a/shiftregister/app/models.py b/shiftregister/app/models.py index ba248c2..f87fe79 100644 --- a/shiftregister/app/models.py +++ b/shiftregister/app/models.py @@ -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 diff --git a/shiftregister/app/templates/shift.html b/shiftregister/app/templates/shift.html index 813e812..7d81140 100644 --- a/shiftregister/app/templates/shift.html +++ b/shiftregister/app/templates/shift.html @@ -14,11 +14,20 @@
Diese Schicht ist bereits besetzt.
{% endif %}
- Ort: {{ shift.room.name }} 📍
- Beginn: {{ shift.start_at }}
- Dauer: {{ shift.duration }}
- Treffpunkt: {{ shift.room.meeting_location|linebreaksbr }}
- {{ shift.description|linebreaksbr }} +

+ Ort: {{ shift.room.name }} 📍
+ Beginn: {{ shift.start_at }}
+ Dauer: {{ shift.duration }}
+ Treffpunkt: {{ shift.room.meeting_location|linebreaksbr }} +

+ {% if shift.room.description %} + Beschreibung: +

{{ shift.room.description|linebreaksbr }}

+ {% endif %} + {% if shift.description %} + Zusatzinfo:
+

{{ shift.description|linebreaksbr }}

+ {% endif %}
{% if can_register and not shift.deleted %}
diff --git a/shiftregister/signage/views.py b/shiftregister/signage/views.py index ec19b52..06b1e73 100644 --- a/shiftregister/signage/views.py +++ b/shiftregister/signage/views.py @@ -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") diff --git a/shiftregister/team/views.py b/shiftregister/team/views.py index 53aa3b3..ea4df2f 100644 --- a/shiftregister/team/views.py +++ b/shiftregister/team/views.py @@ -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)