Compare commits

...

2 Commits

@ -0,0 +1,23 @@
# Generated by Django 4.0.4 on 2023-05-28 10:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("app", "0011_room_description"),
]
operations = [
migrations.AlterField(
model_name="shift",
name="deleted",
field=models.BooleanField(db_index=True, default=False),
),
migrations.AlterField(
model_name="shift",
name="start_at",
field=models.DateTimeField(db_index=True),
),
]

@ -26,13 +26,13 @@ class Room(models.Model):
class Shift(models.Model):
room = models.ForeignKey(Room, on_delete=models.RESTRICT)
start_at = models.DateTimeField()
start_at = models.DateTimeField(db_index=True)
duration = models.DurationField()
required_helpers = models.IntegerField(
default=0, help_text="When this is set to zero, the room value is used instead."
)
description = models.TextField(blank=True, default="")
deleted = models.BooleanField(default=False)
deleted = models.BooleanField(default=False, db_index=True)
def with_reg_count():
return Shift.objects.annotate(

@ -93,7 +93,9 @@ def add_helper_shift(self):
@login_required
def shift_detail(request, pk):
shift = get_object_or_404(Shift, pk=pk)
shift = get_object_or_404(
Shift.with_reg_count().prefetch_related("shiftregistration_set__helper"), pk=pk
)
form = HelperShift()
if request.method == "POST":
form = HelperShift(request.POST)

Loading…
Cancel
Save