Skip to content

Commit

Permalink
make the extension support the script arguments management of django …
Browse files Browse the repository at this point in the history
…1.10 (#132)
  • Loading branch information
mbegoc authored and blag committed Sep 27, 2016
1 parent c03ea69 commit 9939344
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
41 changes: 33 additions & 8 deletions cities/management/commands/cities.py
Expand Up @@ -63,24 +63,49 @@ class Command(BaseCommand):
data_dir = os.path.join(app_dir, 'data')
logger = logging.getLogger(LOGGER_NAME)

option_list = getattr(BaseCommand, 'option_list', ()) + (
make_option(
if django.VERSION < (1, 8):
option_list = getattr(BaseCommand, 'option_list', ()) + (
make_option(
'--force',
action='store_true',
default=False,
help='Import even if files are up-to-date.'),
make_option(
'--import',
metavar="DATA_TYPES",
default='all',
help='Selectively import data. Comma separated list of data ' +
'types: ' + str(import_opts).replace("'", '')),
make_option(
'--flush',
metavar="DATA_TYPES",
default='',
help="Selectively flush data. Comma separated list of data types."),
)

def add_arguments(self, parser):
parser.add_argument(
'--force',
action='store_true',
default=False,
help='Import even if files are up-to-date.'),
make_option(
dest="force",
help='Import even if files are up-to-date.'
)
parser.add_argument(
'--import',
metavar="DATA_TYPES",
default='all',
dest="import",
help='Selectively import data. Comma separated list of data ' +
'types: ' + str(import_opts).replace("'", '')),
make_option(
'types: ' + str(import_opts).replace("'", '')
)
parser.add_argument(
'--flush',
metavar="DATA_TYPES",
default='',
help="Selectively flush data. Comma separated list of data types."),
)
dest="flush",
help="Selectively flush data. Comma separated list of data types."
)

@_transact
def handle(self, *args, **options):
Expand Down
2 changes: 0 additions & 2 deletions cities/plugin/postal_code_ca.py
@@ -1,5 +1,3 @@
from ..conf import *

code_map = {
'AB': '01',
'BC': '02',
Expand Down
2 changes: 0 additions & 2 deletions cities/plugin/reset_queries.py
Expand Up @@ -22,8 +22,6 @@

import random

from ..conf import *

from django.db import reset_queries
from django.conf import settings

Expand Down

0 comments on commit 9939344

Please sign in to comment.