diff --git a/AKModel/migrations/0042_akslot_fixed.py b/AKModel/migrations/0042_akslot_fixed.py new file mode 100644 index 0000000000000000000000000000000000000000..c33ee8f394d64a7705368549416f4a5432c97ede --- /dev/null +++ b/AKModel/migrations/0042_akslot_fixed.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.6 on 2020-11-04 23:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('AKModel', '0041_constraint_violation'), + ] + + operations = [ + migrations.AddField( + model_name='akslot', + name='fixed', + field=models.BooleanField(default=False, help_text='Length and time of this AK should not be changed', verbose_name='Scheduling Fixed'), + ), + ] diff --git a/AKModel/models.py b/AKModel/models.py index d247fbb7632e030bc28656e2f0437e2f5fc038a6..a02e9920fe7e19748cc34d1c7279587faeeabdda 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -316,6 +316,8 @@ class AKSlot(models.Model): duration = models.DecimalField(max_digits=4, decimal_places=2, default=2, verbose_name=_('Duration'), help_text=_('Length in hours')) + fixed = models.BooleanField(default=False, verbose_name=_('Scheduling Fixed'), help_text=_('Length and time of this AK should not be changed')) + event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'), help_text=_('Associated event')) diff --git a/AKScheduling/api.py b/AKScheduling/api.py index 3601b55133b2cd17bba6dbea89f43236032ce567..687704a8e91a48ddd39383d391373d0d1a929648 100644 --- a/AKScheduling/api.py +++ b/AKScheduling/api.py @@ -48,10 +48,10 @@ class EventsView(LoginRequiredMixin, EventSlugMixin, ListView): "start": timezone.localtime(slot.start, self.event.timezone).strftime("%Y-%m-%d %H:%M:%S"), "end": timezone.localtime(slot.end, self.event.timezone).strftime("%Y-%m-%d %H:%M:%S"), "backgroundColor": slot.ak.category.color, - # TODO Mark conflicts here? - "borderColor": slot.ak.category.color, + "borderColor": "#ff291d" if slot.fixed else slot.ak.category.color, "constraint": 'roomAvailable', - 'url': str(reverse('submit:ak_detail', kwargs={"event_slug": self.event.slug, "pk": slot.ak.pk})), + "editable": not slot.fixed, + 'url': str(reverse('admin:AKModel_akslot_change', args=[slot.pk])), } for slot in context["object_list"]], safe=False, **response_kwargs