Create a zip entry for each subdivision found
issue8852 review266761002
This commit is contained in:
1 parent
31750073c5
commit
e891f9b8a0
2 files changed
+8
-4
No files matched your search
@@ -1,3 +1,5 @@
|
||||
* Create a zip entry for each subdivision found
|
||||
|
||||
Version 5.4.0 - 2019-11-04
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
* Replace XML data by import script
|
||||
|
||||
@@ -81,10 +81,12 @@ def import_(data):
|
||||
for row in pbar(list(csv.DictReader(
|
||||
f, fieldnames=_fieldnames, delimiter='\t'))):
|
||||
country = get_country(row['country'])
|
||||
subdivision = get_subdivision(row['country'], row['code1'])
|
||||
zips.append(
|
||||
Zip(country=country, subdivision=subdivision, zip=row['postal'],
|
||||
city=row['place']))
|
||||
for code in ['code1', 'code2', 'code3']:
|
||||
subdivision = get_subdivision(row['country'], row[code])
|
||||
if code == 'code1' or subdivision:
|
||||
zips.append(
|
||||
Zip(country=country, subdivision=subdivision,
|
||||
zip=row['postal'], city=row['place']))
|
||||
Zip.save(zips)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user