Skip to content

Commit

Permalink
Fix #2 ImportError: cannot import name 'NoArgsCommand' with django 1.10
Browse files Browse the repository at this point in the history
Thanks to @xusy2k
  • Loading branch information
sastred committed Nov 4, 2016
1 parent c62516a commit b64a7b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 8 additions & 4 deletions kaio/management/commands/generate_ini.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import sys

from clint.textui import puts, colored
from django.core.management.base import NoArgsCommand
try:
from django.core.management.base import NoArgsCommand
except ImportError:
from django.core.management import BaseCommand as NoArgsCommand

from kaio import Options

Expand All @@ -17,9 +20,7 @@ def module_to_dict(module, omittable=lambda k: k.startswith('_')):


class Command(NoArgsCommand):
help = """Displays differences between the current settings.py and Django's
default settings. Settings that don't appear in the defaults are
followed by "###"."""
help = """Print a .ini with default values in stdout."""

requires_model_validation = False

Expand Down Expand Up @@ -55,3 +56,6 @@ def handle_noargs(self, **options):
except Exception as e:
raise e
puts('')

def handle(self, **options):
return self.handle_noargs(**options)
7 changes: 6 additions & 1 deletion kaio/management/commands/kaiosettings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
# [email protected]

from django.core.management.base import NoArgsCommand
try:
from django.core.management.base import NoArgsCommand
except ImportError:
from django.core.management import BaseCommand as NoArgsCommand

from kaio import Options

Expand Down Expand Up @@ -88,3 +91,5 @@ def handle_noargs(self, **options):
colored.green(user_settings[key])))
#colored.white(default_settings[key])))

def handle(self, **options):
return self.handle_noargs(**options)

0 comments on commit b64a7b2

Please sign in to comment.