From a872b441b4e0bc6029e9e9531b329412325c2991 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sat, 17 Feb 2024 15:46:49 +0100 Subject: [PATCH] =?UTF-8?q?On=20corrige=20des=20bugs=20dans=20le=20cas=20o?= =?UTF-8?q?=C3=B9=20la=20localisation=20n'est=20pas=20d=C3=A9finie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0035_alter_event_location.py | 18 ++++++++++++++++++ src/agenda_culturel/models.py | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/agenda_culturel/migrations/0035_alter_event_location.py 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"] = ""