summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ishtar_common/management/commands/import_geofla_csv.py5
-rw-r--r--ishtar_common/tests.py1
2 files changed, 4 insertions, 2 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
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index d882cd85b..2b0a87386 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -115,7 +115,6 @@ class CommandsTestCase(TestCase):
self.assertEqual(town_nb + 9, models.Town.objects.count())
-
class WizardTestFormData(object):
"""
Test set to simulate wizard steps