diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-10-27 09:50:31 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-10-27 09:50:31 +0200 |
commit | 72a1783b7617ce501f598b7d6cc5868a15ff5fe5 (patch) | |
tree | c4f7633ad76a5f1b33c6a4c7aceff79b2278a0e6 /ishtar_common/management | |
parent | 4be73e1e4cbcab26e71abbd973dd982055aa20fa (diff) | |
download | Ishtar-72a1783b7617ce501f598b7d6cc5868a15ff5fe5.tar.bz2 Ishtar-72a1783b7617ce501f598b7d6cc5868a15ff5fe5.zip |
Command import_geofla_csv: manage town request with year
Diffstat (limited to 'ishtar_common/management')
-rw-r--r-- | ishtar_common/management/commands/import_geofla_csv.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ishtar_common/management/commands/import_geofla_csv.py b/ishtar_common/management/commands/import_geofla_csv.py index 80e10bc81..28c2dabf5 100644 --- a/ishtar_common/management/commands/import_geofla_csv.py +++ b/ishtar_common/management/commands/import_geofla_csv.py @@ -51,7 +51,10 @@ class Command(BaseCommand): q = Town.objects.filter(numero_insee=num_insee) changed, created = False, False if q.count(): - town = q.all()[0] + if q.filter(year=default_year).count(): + town = q.filter(year=default_year).all()[0] + else: + town = q.order_by('-year').all()[0] else: changed = True created = True |