Skip to content

Commit

Permalink
fixed settings command
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed May 29, 2017
1 parent fc1acd6 commit a3be99b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions django_utils/management/commands/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import six
import json
import pprint

from django.conf import settings

from . import base_command
import pprint


class Command(base_command.CustomBaseCommand):
Expand All @@ -18,7 +19,7 @@ class Command(base_command.CustomBaseCommand):
def add_arguments(self, parser):
parser.add_argument('keys', nargs='+')
parser.add_argument(
'-o', '--output-type',
'-o', '--output-type', default='pprint',
choices=['pprint', 'print', 'json', 'csv'])
parser.add_argument('-k', '--show-keys', action='store_true')

Expand Down Expand Up @@ -62,6 +63,7 @@ def render_output(self, data, output_type='pprint', show_keys=False,

values[i] = value

out += values
print(','.join(out))

elif output_type == 'json':
Expand All @@ -72,7 +74,7 @@ def handle(self, *args, **options):
args = list(map(str.upper, options.get('keys', [])))
data = dict()
for key in dir(settings):
if key.upper() == key:
if key.isupper():
value = getattr(settings, key)
found = False
for arg in args:
Expand Down

0 comments on commit a3be99b

Please sign in to comment.