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 | 6b80f7b90c714c335533fa55ba5bf859de717e38 (patch) | |
tree | c4f7633ad76a5f1b33c6a4c7aceff79b2278a0e6 /ishtar_common | |
parent | d2ae0229edb74a1d19c5830772bfa3f0dc59f441 (diff) | |
download | Ishtar-6b80f7b90c714c335533fa55ba5bf859de717e38.tar.bz2 Ishtar-6b80f7b90c714c335533fa55ba5bf859de717e38.zip |
Command import_geofla_csv: manage town request with year
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/management/commands/import_geofla_csv.py | 5 | ||||
-rw-r--r-- | ishtar_common/tests.py | 1 |
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 |