summaryrefslogtreecommitdiff
path: root/ishtar_common/management
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-10-27 18:07:15 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-10-27 18:07:15 +0200
commite85f90cf4a29aa5b5bf228afa4330e91d04e8e63 (patch)
tree745ab6f2dde81ee426707414b1d18213decae6f9 /ishtar_common/management
parentc8d3021cee3397e200df30eac12984b5770adb6c (diff)
downloadIshtar-e85f90cf4a29aa5b5bf228afa4330e91d04e8e63.tar.bz2
Ishtar-e85f90cf4a29aa5b5bf228afa4330e91d04e8e63.zip
Command import_insee_comm_csv: fix old town request - fix unicode issue
Diffstat (limited to 'ishtar_common/management')
-rw-r--r--ishtar_common/management/commands/import_insee_comm_csv.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ishtar_common/management/commands/import_insee_comm_csv.py b/ishtar_common/management/commands/import_insee_comm_csv.py
index e64fe42bb..d0fccb2fc 100644
--- a/ishtar_common/management/commands/import_insee_comm_csv.py
+++ b/ishtar_common/management/commands/import_insee_comm_csv.py
@@ -61,7 +61,7 @@ class Command(BaseCommand):
missing.append((old_insee, row['NomCA']))
continue
if q.count() > 1:
- q = q.filter(year_lt=default_year).order_by('-year')
+ q = q.filter(year__lt=default_year).order_by('-year')
if not q.count():
strange.append((old_insee, row['NomCA']))
continue
@@ -74,7 +74,7 @@ class Command(BaseCommand):
year=default_year)
if not q.count():
nb_created += 1
- name = row['NomCN'].upper().strip()
+ name = row['NomCN'].decode('utf-8').upper().strip()
name = r.sub(r"\2 \1", name).strip()
new_town = Town.objects.create(name=name, year=default_year,
numero_insee=new_insee)
@@ -86,6 +86,7 @@ class Command(BaseCommand):
old_town.children.add(new_town)
linked.add(new_town)
nb_limit = 0
+ sys.stdout.write('\nGenerate limits...'.format(nb_created))
for town in linked:
if town.generate_geo():
nb_limit += 1