feat: Add specific shift date field for multi-day events with date selector in EventEditor and date badge in ShiftMatrix
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 6.0.7 on 2026-07-31 08:51
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('events', '0003_event_is_active'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='shift',
|
||||
name='date',
|
||||
field=models.DateField(blank=True, help_text='Spezifisches Datum für mehrtägige Veranstaltungen', null=True),
|
||||
),
|
||||
]
|
||||
Binary file not shown.
@@ -39,13 +39,15 @@ class TaskArea(models.Model):
|
||||
class Shift(models.Model):
|
||||
task_area = models.ForeignKey(TaskArea, on_delete=models.CASCADE, related_name='shifts')
|
||||
title = models.CharField(max_length=150) # e.g., "Frühschicht", "14:00 - 18:00"
|
||||
date = models.DateField(null=True, blank=True, help_text="Spezifisches Datum für mehrtägige Veranstaltungen")
|
||||
start_time = models.CharField(max_length=50) # e.g. "14:00" or ISO string
|
||||
end_time = models.CharField(max_length=50) # e.g. "18:00" or ISO string
|
||||
max_participants = models.PositiveIntegerField(default=1)
|
||||
required_skills = models.ManyToManyField(Skill, blank=True, related_name='shifts')
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.task_area.name}: {self.title} ({self.start_time} - {self.end_time})"
|
||||
date_str = f" ({self.date.strftime('%d.%m.%Y')})" if self.date else ""
|
||||
return f"{self.task_area.name}: {self.title}{date_str} ({self.start_time} - {self.end_time})"
|
||||
|
||||
class ShiftSignup(models.Model):
|
||||
shift = models.ForeignKey(Shift, on_delete=models.CASCADE, related_name='signups')
|
||||
|
||||
@@ -39,7 +39,7 @@ class ShiftSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Shift
|
||||
fields = [
|
||||
'id', 'task_area', 'title', 'start_time', 'end_time',
|
||||
'id', 'task_area', 'title', 'date', 'start_time', 'end_time',
|
||||
'max_participants', 'required_skills', 'required_skill_ids',
|
||||
'signups', 'signups_count', 'is_full'
|
||||
]
|
||||
|
||||
@@ -369,6 +369,7 @@ class EventTemplateViewSet(viewsets.ModelViewSet):
|
||||
shift = Shift.objects.create(
|
||||
task_area=ta,
|
||||
title=shift_data.get('title', 'Schicht'),
|
||||
date=shift_data.get('date') or start_date,
|
||||
start_time=shift_data.get('start_time', '18:00'),
|
||||
end_time=shift_data.get('end_time', '22:00'),
|
||||
max_participants=shift_data.get('max_participants', 1)
|
||||
|
||||
Reference in New Issue
Block a user