Ajout d'une entrée code postal

This commit is contained in:
Jean-Marie Favreau 2024-12-06 23:24:08 +01:00
parent bd1330cd2f
commit f52caf9855
3 changed files with 21 additions and 1 deletions

View File

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

View File

@ -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"),

View File

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