django-cities: NameError: global name 'VALIDATE_POSTAL_CODES' is not defined

running the following command on command line produces the following error:

python manage.py cities --import=postal_code

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/mnt/data/dev/budhub/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line  
    utility.execute()
  File "/mnt/data/dev/budhub/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/mnt/data/dev/budhub/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/mnt/data/dev/budhub/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/mnt/data/dev/budhub/venv/local/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
    return func(*args, **kwargs)
  File "/mnt/data/dev/budhub/venv/local/lib/python2.7/site-packages/cities/management/commands/cities.py", line 146, in handle
    func()
  File "/mnt/data/dev/budhub/venv/local/lib/python2.7/site-packages/cities/management/commands/cities.py", line 751, in import_postal_code
    if VALIDATE_POSTAL_CODES:
NameError: global name 'VALIDATE_POSTAL_CODES' is not defined

Seems to be missing an import on the cities management command in the current master branch.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 25 (5 by maintainers)

Most upvoted comments

Closing - pushed to PyPI as version 0.5. Thank you all for your help!

@blag can confirm that import process works right till end ! Congratulations and thanks again !

@spout did you try removing the unique=True from SlugModel ? Or combine it by replacing self.id with self.code https://github.com/coderholic/django-cities/blob/master/cities/models.py#L279 (comment in #146)