Skip to content
Snippets Groups Projects
Commit acac1a62 authored by Benjamin Hättasch's avatar Benjamin Hättasch
Browse files

Introduce possibility to mark an AK Slot as fixed

This prevents it from being edited in scheduling view
parent 643298be
No related branches found
No related tags found
No related merge requests found
# 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'),
),
]
...@@ -316,6 +316,8 @@ class AKSlot(models.Model): ...@@ -316,6 +316,8 @@ class AKSlot(models.Model):
duration = models.DecimalField(max_digits=4, decimal_places=2, default=2, verbose_name=_('Duration'), duration = models.DecimalField(max_digits=4, decimal_places=2, default=2, verbose_name=_('Duration'),
help_text=_('Length in hours')) 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'), event = models.ForeignKey(to=Event, on_delete=models.CASCADE, verbose_name=_('Event'),
help_text=_('Associated event')) help_text=_('Associated event'))
......
...@@ -48,10 +48,10 @@ class EventsView(LoginRequiredMixin, EventSlugMixin, ListView): ...@@ -48,10 +48,10 @@ class EventsView(LoginRequiredMixin, EventSlugMixin, ListView):
"start": timezone.localtime(slot.start, self.event.timezone).strftime("%Y-%m-%d %H:%M:%S"), "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"), "end": timezone.localtime(slot.end, self.event.timezone).strftime("%Y-%m-%d %H:%M:%S"),
"backgroundColor": slot.ak.category.color, "backgroundColor": slot.ak.category.color,
# TODO Mark conflicts here? "borderColor": "#ff291d" if slot.fixed else slot.ak.category.color,
"borderColor": slot.ak.category.color,
"constraint": 'roomAvailable', "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"]], } for slot in context["object_list"]],
safe=False, safe=False,
**response_kwargs **response_kwargs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment