On corrige des bugs dans le cas où la localisation n'est pas définie

This commit is contained in:
Jean-Marie Favreau 2024-02-17 15:46:49 +01:00
parent 04cb096fa5
commit a872b441b4
2 changed files with 22 additions and 1 deletions

View File

@ -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'),
),
]

View File

@ -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"] = ""