diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py
index 7bdcc42..1238e93 100644
a
|
b
|
class Command(BaseCommand):
|
13 | 13 | args = '[appname ...]' |
14 | 14 | |
15 | 15 | def handle(self, *app_labels, **options): |
16 | | from django.db.models import get_app, get_apps, get_models |
| 16 | from django.db.models import get_app, get_apps, get_models, get_model |
17 | 17 | from django.core import serializers |
18 | 18 | |
19 | 19 | format = options.get('format', 'json') |
20 | 20 | indent = options.get('indent', None) |
21 | | |
| 21 | |
22 | 22 | if len(app_labels) == 0: |
23 | 23 | app_list = get_apps() |
24 | 24 | else: |
25 | | app_list = [get_app(app_label) for app_label in app_labels] |
| 25 | app_list = [] |
| 26 | model_list = [] |
| 27 | for app_label in app_labels: |
| 28 | app_model_label = app_label.split('.') |
| 29 | if len(app_model_label) <= 1: |
| 30 | app_list.append(get_app(app_label)) |
| 31 | else: |
| 32 | model_list.append(get_model(app_model_label[0], app_model_label[1])) |
26 | 33 | |
27 | 34 | # Check that the serialization format exists; this is a shortcut to |
28 | 35 | # avoid collating all the objects and _then_ failing. |
… |
… |
class Command(BaseCommand):
|
35 | 42 | for app in app_list: |
36 | 43 | for model in get_models(app): |
37 | 44 | objects.extend(model.objects.all()) |
| 45 | |
| 46 | for model in model_list: |
| 47 | objects.extend(model.objects.all()) |
| 48 | |
38 | 49 | try: |
39 | 50 | return serializers.serialize(format, objects, indent=indent) |
40 | 51 | except Exception, e: |