app/django/core/management/commands/dumpdata.py
changeset 323 ff1a9aa48cfd
parent 54 03e267d67478
--- a/app/django/core/management/commands/dumpdata.py	Tue Oct 14 12:36:55 2008 +0000
+++ b/app/django/core/management/commands/dumpdata.py	Tue Oct 14 16:00:59 2008 +0000
@@ -9,6 +9,8 @@
             help='Specifies the output serialization format for fixtures.'),
         make_option('--indent', default=None, dest='indent', type='int',
             help='Specifies the indent level to use when pretty-printing output'),
+        make_option('-e', '--exclude', dest='exclude',action='append', default=[], 
+            help='App to exclude (use multiple --exclude to exclude multiple apps).'),
     )
     help = 'Output the contents of the database as a fixture of the given format.'
     args = '[appname ...]'
@@ -16,12 +18,15 @@
     def handle(self, *app_labels, **options):
         from django.db.models import get_app, get_apps, get_models
 
-        format = options.get('format', 'json')
-        indent = options.get('indent', None)
+        format = options.get('format','json')
+        indent = options.get('indent',None)
+        exclude = options.get('exclude',[])
         show_traceback = options.get('traceback', False)
 
+        excluded_apps = [get_app(app_label) for app_label in exclude]
+
         if len(app_labels) == 0:
-            app_list = get_apps()
+            app_list = [app for app in get_apps() if app not in excluded_apps]
         else:
             app_list = [get_app(app_label) for app_label in app_labels]