Skip to content

Commit

Permalink
Manage CLEF address importation based on 2 columns
Browse files Browse the repository at this point in the history
  • Loading branch information
mlvernay committed Dec 16, 2024
1 parent 8a81559 commit 5679d98
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion accommodation/management/commands/import_CLEF.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def handle(self, *args, **options):
accommodation = Accommodation(name=name)

for attr_db, attr_clef in [
("address", "Adresse administrative"),
("city", "Commune"),
("postal_code", "Code postal"),
("owner_name", "Gestionnaire - Nom"),
Expand All @@ -62,6 +61,8 @@ def handle(self, *args, **options):

setattr(accommodation, attr_db, value)

accommodation.address = row.get("Adresse administrative") or row.get("Adresse géolocalisée")

if (latitude := row.get("Latitude")) and (longitude := row.get("Longitude")):
try:
accommodation.geom = Point(
Expand Down

0 comments on commit 5679d98

Please sign in to comment.