diff options
| 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 | 
| commit | 70c5566cf88ef14280d51df9f9f280bd1a3bb073 (patch) | |
| tree | 745ab6f2dde81ee426707414b1d18213decae6f9 /ishtar_common/management/commands | |
| parent | a3aa47a3cc09cdc8d13a33f909aadc70cbbe3397 (diff) | |
| download | Ishtar-70c5566cf88ef14280d51df9f9f280bd1a3bb073.tar.bz2 Ishtar-70c5566cf88ef14280d51df9f9f280bd1a3bb073.zip | |
Command import_insee_comm_csv: fix old town request - fix unicode issue
Diffstat (limited to 'ishtar_common/management/commands')
| -rw-r--r-- | ishtar_common/management/commands/import_insee_comm_csv.py | 5 | 
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 | 
