Simple app to add configuration options to a Django project.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

export current options command

+28
+1
HISTORY.rst
··· 7 7 +++++++++++++++++ 8 8 9 9 * Add search options to admin. 10 + * Export current options command. 10 11 11 12 1.0a1 (2017-2-20) 12 13 +++++++++++++++++
+2
options/management/__init__.py
··· 1 + # -*- coding: utf-8 -*- 2 + from __future__ import unicode_literals, print_function, division, absolute_import
+2
options/management/commands/__init__.py
··· 1 + # -*- coding: utf-8 -*- 2 + from __future__ import unicode_literals, print_function, division, absolute_import
+22
options/management/commands/export_options.py
··· 1 + # -*- coding: utf-8 -*- 2 + from __future__ import unicode_literals, print_function, division, absolute_import 3 + 4 + import json 5 + 6 + from django.core.management import BaseCommand 7 + 8 + from options.models import Option 9 + 10 + 11 + class Command(BaseCommand): 12 + help = "Export current options to JSON format." 13 + 14 + def handle(self, *args, **options): 15 + export = dict() 16 + for option in Option.objects.all(): 17 + export[option.name] = { 18 + "value": option.value, 19 + "type": option.type, 20 + "public_name": option.public_name 21 + } 22 + self.stdout.write(json.dumps(export, indent=4, sort_keys=True))
+1
setup.py
··· 22 22 name='django-simple-options', 23 23 version=version, 24 24 packages=[ 25 + 'options.management.commands', 25 26 'options.migrations', 26 27 'options', 27 28 ],