diff --git a/src/agenda_culturel/migrations/0035_alter_event_location.py b/src/agenda_culturel/migrations/0035_alter_event_location.py new file mode 100644 index 0000000..b815977 --- /dev/null +++ b/src/agenda_culturel/migrations/0035_alter_event_location.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.7 on 2024-02-17 14:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('agenda_culturel', '0034_recurrentimport_name'), + ] + + operations = [ + migrations.AlterField( + model_name='event', + name='location', + field=models.CharField(default='', help_text='Address of the event', max_length=512, verbose_name='Location'), + ), + ] diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 84533b1..030d78e 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -179,7 +179,7 @@ class Event(models.Model): recurrences = recurrence.fields.RecurrenceField(verbose_name=_("Recurrence"), include_dtstart=False, blank=True, null=True) - location = models.CharField(verbose_name=_('Location'), help_text=_('Address of the event'), max_length=512) + location = models.CharField(verbose_name=_('Location'), help_text=_('Address of the event'), max_length=512, default="") description = models.TextField(verbose_name=_('Description'), help_text=_('General description of the event'), blank=True, null=True) @@ -434,6 +434,9 @@ class Event(models.Model): if "end_time" in event_structure: event_structure["end_time"] = time.fromisoformat(event_structure["end_time"]) + if "location" not in event_structure or event_structure["location"] is None: + event_structure["location"] = "" + if "description" in event_structure and event_structure["description"] is None: event_structure["description"] = ""