### Eclipse Workspace Patch 1.0
#P django-trunk
Index: django/core/management/commands/dumpdata.py
===================================================================
--- django/core/management/commands/dumpdata.py	(revision 13404)
+++ django/core/management/commands/dumpdata.py	(working copy)
@@ -16,7 +16,7 @@
             default=DEFAULT_DB_ALIAS, help='Nominates a specific database to load '
                 'fixtures into. Defaults to the "default" database.'),
         make_option('-e', '--exclude', dest='exclude',action='append', default=[],
-            help='App to exclude (use multiple --exclude to exclude multiple apps).'),
+            help='An appname or appname.ModelName to exclude (use multiple --exclude to exclude multiple apps/models).'),
         make_option('-n', '--natural', action='store_true', dest='use_natural_keys', default=False,
             help='Use natural keys if they are available.'),
     )
@@ -30,14 +30,28 @@
         indent = options.get('indent',None)
         using = options.get('database', DEFAULT_DB_ALIAS)
         connection = connections[using]
-        exclude = options.get('exclude',[])
+        excludes = options.get('exclude',[])
         show_traceback = options.get('traceback', False)
         use_natural_keys = options.get('use_natural_keys', False)
 
-        excluded_apps = set(get_app(app_label) for app_label in exclude)
+        excluded_objs = set()
+        for exclude in excludes:
+            if '.' in exclude:
+                app_label, model_name = exclude.split('.', 1)
+                model_obj = get_model(app_label, model_name)
+                if not model_obj:
+                    raise CommandError('Unknown model in excludes: %s' % exclude)
+                excluded_objs.add(model_obj)
+            else:
+                try:
+                    app_obj = get_app(exclude)
+                except ImproperlyConfigured:
+                    raise CommandError('Unknown app in excludes: %s' % exclude)
+                else:
+                    excluded_objs.add(app_obj)
 
         if len(app_labels) == 0:
-            app_list = SortedDict((app, None) for app in get_apps() if app not in excluded_apps)
+            app_list = SortedDict((app, None) for app in get_apps() if app not in excluded_objs)
         else:
             app_list = SortedDict()
             for label in app_labels:
@@ -47,7 +61,8 @@
                         app = get_app(app_label)
                     except ImproperlyConfigured:
                         raise CommandError("Unknown application: %s" % app_label)
-
+                    if app in excluded_objs:
+                        continue
                     model = get_model(app_label, model_label)
                     if model is None:
                         raise CommandError("Unknown model: %s.%s" % (app_label, model_label))
@@ -64,6 +79,8 @@
                         app = get_app(app_label)
                     except ImproperlyConfigured:
                         raise CommandError("Unknown application: %s" % app_label)
+                    if app in excluded_objs:
+                        continue
                     app_list[app] = None
 
         # Check that the serialization format exists; this is a shortcut to
@@ -79,6 +96,8 @@
         # Now collate the objects to be serialized.
         objects = []
         for model in sort_dependencies(app_list.items()):
+            if model in excluded_objs:
+                continue
             if not model._meta.proxy and router.allow_syncdb(using, model):
                 objects.extend(model._default_manager.using(using).all())
 
Index: docs/ref/django-admin.txt
===================================================================
--- docs/ref/django-admin.txt	(revision 13404)
+++ docs/ref/django-admin.txt	(working copy)
@@ -227,6 +227,11 @@
 The :djadminopt:`--exclude` option may be provided to prevent specific
 applications from being dumped.
 
+.. versionadded:: 1.3
+
+The :djadminopt:`--exclude` option may be provided to prevent specific
+individual models, in the form of ``appname.ModelName``, from being dumped.
+
 .. versionadded:: 1.1
 
 In addition to specifying application names, you can provide a list of
Index: tests/modeltests/fixtures/tests.py
===================================================================
--- tests/modeltests/fixtures/tests.py	(revision 13404)
+++ tests/modeltests/fixtures/tests.py	(working copy)
@@ -23,9 +23,13 @@
 
 class FixtureLoadingTests(TestCase):
 
-    def _dumpdata_assert(self, args, output, format='json', natural_keys=False):
+    def _dumpdata_assert(self, args, output, format='json', natural_keys=False,
+                         exclude_list=[]):
         new_io = StringIO.StringIO()
-        management.call_command('dumpdata', *args, **{'format':format, 'stdout':new_io, 'use_natural_keys':natural_keys})
+        management.call_command('dumpdata', *args, **{'format':format, 
+                                                      'stdout':new_io, 
+                                                      'use_natural_keys':natural_keys,
+                                                      'exclude': exclude_list})
         command_output = new_io.getvalue().strip()
         self.assertEqual(command_output, output)
 
@@ -150,6 +154,36 @@
         self._dumpdata_assert(['fixtures'], """<?xml version="1.0" encoding="utf-8"?>
 <django-objects version="1.0"><object pk="1" model="fixtures.category"><field type="CharField" name="title">News Stories</field><field type="TextField" name="description">Latest news stories</field></object><object pk="5" model="fixtures.article"><field type="CharField" name="headline">XML identified as leading cause of cancer</field><field type="DateTimeField" name="pub_date">2006-06-16 16:00:00</field></object><object pk="4" model="fixtures.article"><field type="CharField" name="headline">Django conquers world!</field><field type="DateTimeField" name="pub_date">2006-06-16 15:00:00</field></object><object pk="3" model="fixtures.article"><field type="CharField" name="headline">Copyright is fine the way it is</field><field type="DateTimeField" name="pub_date">2006-06-16 14:00:00</field></object><object pk="2" model="fixtures.article"><field type="CharField" name="headline">Poker on TV is great!</field><field type="DateTimeField" name="pub_date">2006-06-16 11:00:00</field></object><object pk="1" model="fixtures.article"><field type="CharField" name="headline">Python program becomes self aware</field><field type="DateTimeField" name="pub_date">2006-06-16 11:00:00</field></object><object pk="1" model="fixtures.tag"><field type="CharField" name="name">copyright</field><field to="contenttypes.contenttype" name="tagged_type" rel="ManyToOneRel"><natural>fixtures</natural><natural>article</natural></field><field type="PositiveIntegerField" name="tagged_id">3</field></object><object pk="2" model="fixtures.tag"><field type="CharField" name="name">legal</field><field to="contenttypes.contenttype" name="tagged_type" rel="ManyToOneRel"><natural>fixtures</natural><natural>article</natural></field><field type="PositiveIntegerField" name="tagged_id">3</field></object><object pk="3" model="fixtures.tag"><field type="CharField" name="name">django</field><field to="contenttypes.contenttype" name="tagged_type" rel="ManyToOneRel"><natural>fixtures</natural><natural>article</natural></field><field type="PositiveIntegerField" name="tagged_id">4</field></object><object pk="4" model="fixtures.tag"><field type="CharField" name="name">world domination</field><field to="contenttypes.contenttype" name="tagged_type" rel="ManyToOneRel"><natural>fixtures</natural><natural>article</natural></field><field type="PositiveIntegerField" name="tagged_id">4</field></object><object pk="3" model="fixtures.person"><field type="CharField" name="name">Artist formerly known as "Prince"</field></object><object pk="1" model="fixtures.person"><field type="CharField" name="name">Django Reinhardt</field></object><object pk="2" model="fixtures.person"><field type="CharField" name="name">Stephane Grappelli</field></object><object pk="1" model="fixtures.visa"><field to="fixtures.person" name="person" rel="ManyToOneRel"><natural>Django Reinhardt</natural></field><field to="auth.permission" name="permissions" rel="ManyToManyRel"><object><natural>add_user</natural><natural>auth</natural><natural>user</natural></object><object><natural>change_user</natural><natural>auth</natural><natural>user</natural></object><object><natural>delete_user</natural><natural>auth</natural><natural>user</natural></object></field></object><object pk="2" model="fixtures.visa"><field to="fixtures.person" name="person" rel="ManyToOneRel"><natural>Stephane Grappelli</natural></field><field to="auth.permission" name="permissions" rel="ManyToManyRel"><object><natural>add_user</natural><natural>auth</natural><natural>user</natural></object><object><natural>delete_user</natural><natural>auth</natural><natural>user</natural></object></field></object><object pk="3" model="fixtures.visa"><field to="fixtures.person" name="person" rel="ManyToOneRel"><natural>Artist formerly known as "Prince"</natural></field><field to="auth.permission" name="permissions" rel="ManyToManyRel"><object><natural>change_user</natural><natural>auth</natural><natural>user</natural></object></field></object><object pk="1" model="fixtures.book"><field type="CharField" name="name">Music for all ages</field><field to="fixtures.person" name="authors" rel="ManyToManyRel"><object><natural>Artist formerly known as "Prince"</natural></object><object><natural>Django Reinhardt</natural></object></field></object></django-objects>""", format='xml', natural_keys=True)
 
+    def test_dumpdata_with_excludes(self):
+        # Load fixture1 which has a site, two articles, and a category
+        management.call_command('loaddata', 'fixture1.json', verbosity=0, commit=False)
+        
+        # Excluding fixtures app should only leave sites
+        self._dumpdata_assert(
+            ['sites', 'fixtures'], 
+            '[{"pk": 1, "model": "sites.site", "fields": {"domain": "example.com", "name": "example.com"}}]', 
+            exclude_list=['fixtures'])
+        
+        # Excluding fixtures.Article should leave fixtures.category
+        self._dumpdata_assert(
+            ['sites', 'fixtures'], 
+            '[{"pk": 1, "model": "sites.site", "fields": {"domain": "example.com", "name": "example.com"}}, {"pk": 1, "model": "fixtures.category", "fields": {"description": "Latest news stories", "title": "News Stories"}}]', 
+            exclude_list=['fixtures.Article'])
+
+        # Excluding a bogus app should throw an error
+        self.assertRaises(SystemExit,
+                          self._dumpdata_assert,
+                          ['fixtures', 'sites'],
+                          '',
+                          exclude_list=['foo_app'])
+        
+        # Excluding a bogus model should throw an error
+        self.assertRaises(SystemExit,
+                          self._dumpdata_assert,
+                          ['fixtures', 'sites'],
+                          '',
+                          exclude_list=['fixtures.FooModel'])
+
     def test_compress_format_loading(self):
         # Load fixture 4 (compressed), using format specification
         management.call_command('loaddata', 'fixture4.json', verbosity=0, commit=False)
