From f52caf98551af8337eb8dbabfd7e897731b8ead3 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Fri, 6 Dec 2024 23:24:08 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'une=20entr=C3=A9e=20code=20postal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0124_place_postcode.py | 18 ++++++++++++++++++ src/agenda_culturel/models.py | 3 ++- src/agenda_culturel/views.py | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/agenda_culturel/migrations/0124_place_postcode.py diff --git a/src/agenda_culturel/migrations/0124_place_postcode.py b/src/agenda_culturel/migrations/0124_place_postcode.py new file mode 100644 index 0000000..9581868 --- /dev/null +++ b/src/agenda_culturel/migrations/0124_place_postcode.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.9 on 2024-12-06 21:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('agenda_culturel', '0123_event_created_by_user_event_imported_by_user_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='place', + name='postcode', + field=models.CharField(blank=True, help_text='The post code is not displayed, but makes it easier to find an address when you enter it.', null=True, verbose_name='Postcode'), + ), + ] diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 5a5a969..510c06b 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -435,8 +435,9 @@ class Place(models.Model): blank=True, null=True, ) + postcode = models.CharField(verbose_name=_("Postcode"), help_text=_("The post code is not displayed, but makes it easier to find an address when you enter it."), blank=True, null=True) city = models.CharField(verbose_name=_("City"), help_text=_("City name")) - location = LocationField(based_fields=["name", "address", "city"], zoom=12, default=Point(3.08333, 45.783329)) + location = LocationField(based_fields=["name", "address", "postcode", "city"], zoom=12, default=Point(3.08333, 45.783329)) description = CKEditor5Field( verbose_name=_("Description"), diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index eb7aa39..27eed27 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -1880,6 +1880,7 @@ class PlaceFromEventCreateView(PlaceCreateView): name, address, postcode, city = guesser.guess_address_elements(self.event.location) initial["name"] = name initial["address"] = address + initial["postcode"] = postcode initial["city"] = city initial["location"] = ""