Changeset 4661
- Timestamp:
- 03/01/07 20:28:44 (2 years ago)
- Files:
-
- django/trunk/django/core/management.py (modified) (4 diffs)
- django/trunk/docs/django-admin.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/management.py
r4659 r4661 1414 1414 load_data.args = "[--verbosity] fixture, fixture, ..." 1415 1415 1416 def dump_data(app_labels, format='json' ):1416 def dump_data(app_labels, format='json', indent=None): 1417 1417 "Output the current contents of the database as a fixture of the given format" 1418 1418 from django.db.models import get_app, get_apps, get_models … … 1436 1436 objects.extend(model.objects.all()) 1437 1437 try: 1438 print serializers.serialize(format, objects )1438 print serializers.serialize(format, objects, indent=indent) 1439 1439 except Exception, e: 1440 1440 sys.stderr.write(style.ERROR("Unable to serialize database: %s\n" % e)) … … 1526 1526 parser.add_option('--format', default='json', dest='format', 1527 1527 help='Specifies the output serialization format for fixtures') 1528 parser.add_option('--indent', default=None, dest='indent', 1529 type='int', help='Specifies the indent level to use when pretty-printing output') 1528 1530 parser.add_option('--verbosity', action='store', dest='verbosity', default='1', 1529 1531 type='choice', choices=['0', '1', '2'], … … 1580 1582 elif action == 'dumpdata': 1581 1583 try: 1582 action_mapping[action](args[1:], options.format )1584 action_mapping[action](args[1:], options.format, options.indent) 1583 1585 except IndexError: 1584 1586 parser.print_usage_and_exit() django/trunk/docs/django-admin.txt
r4659 r4661 474 474 475 475 --format 476 -------- -476 -------- 477 477 478 478 **New in Django development version** … … 490 490 Displays a help message that includes a terse list of all available actions and 491 491 options. 492 493 --indent 494 -------- 495 496 **New in Django development version** 497 498 Example usage:: 499 500 django-admin.py dumpdata --indent=4 501 502 Specifies the number of spaces that will be used for indentation when 503 pretty-printing output. By default, output will *not* be pretty-printed. 504 Pretty-printing will only be enabled if the indent option is provided. 492 505 493 506 --noinput
