diff --git a/shiftregister/app/migrations/0005_shift_description_alter_shift_required_helpers.py b/shiftregister/app/migrations/0005_shift_description_alter_shift_required_helpers.py new file mode 100644 index 0000000..dc34b48 --- /dev/null +++ b/shiftregister/app/migrations/0005_shift_description_alter_shift_required_helpers.py @@ -0,0 +1,26 @@ +# Generated by Django 4.0.4 on 2022-05-10 16:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("app", "0004_shift_required_helpers"), + ] + + operations = [ + migrations.AddField( + model_name="shift", + name="description", + field=models.TextField(default=""), + ), + migrations.AlterField( + model_name="shift", + name="required_helpers", + field=models.IntegerField( + default=0, + help_text="When this is set to zero, the room value is used instead.", + ), + ), + ] diff --git a/shiftregister/app/migrations/0006_alter_shift_description.py b/shiftregister/app/migrations/0006_alter_shift_description.py new file mode 100644 index 0000000..622af8d --- /dev/null +++ b/shiftregister/app/migrations/0006_alter_shift_description.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.4 on 2022-05-10 16:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("app", "0005_shift_description_alter_shift_required_helpers"), + ] + + operations = [ + migrations.AlterField( + model_name="shift", + name="description", + field=models.TextField(blank=True, default=""), + ), + ] diff --git a/shiftregister/app/models.py b/shiftregister/app/models.py index 14509f1..be228ff 100644 --- a/shiftregister/app/models.py +++ b/shiftregister/app/models.py @@ -25,6 +25,7 @@ class Shift(models.Model): 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) def __str__(self): diff --git a/shiftregister/importer/importer.py b/shiftregister/importer/importer.py index ee35dea..7496c80 100644 --- a/shiftregister/importer/importer.py +++ b/shiftregister/importer/importer.py @@ -26,6 +26,7 @@ def import_calendar(calendar): for event in cal.walk("vevent"): uid = event.decoded("uid").decode() summary = event.decoded("summary").decode() + description = (event.decoded("description", None) or b"").decode() start = event.decoded("dtstart").astimezone(timezone.utc) end = event.decoded("dtend").astimezone(timezone.utc) location = event.decoded("location", None) @@ -56,6 +57,7 @@ def import_calendar(calendar): "start_at": start, "duration": end - start, "required_helpers": required_helpers, + "description": description, "uuid": uid, "calendar": calendar, }, @@ -79,6 +81,7 @@ def import_calendar(calendar): e.start_at = event["start_at"] e.duration = event["duration"] e.required_helpers = event["required_helpers"] + e.description = event["description"] e.save() events[uuid] = (room, e)