diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2013-05-19 03:54:29 -0700 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2013-05-19 03:54:29 -0700 |
| commit | 7a99d1e167f81c5fcd1b9f7f548c5d6959cef2ef (patch) | |
| tree | 95b881b3517c7ca713decac8957811f081a16215 /django | |
| parent | cc62cbed76daeaea28c1e4892244bcf1e148f373 (diff) | |
| parent | 65c557115f6e76293c39ce7b73b62216911f9489 (diff) | |
Merge pull request #1134 from senko/ticket_18990
Fixed #18990: Loaddata now complains if fixture doesn't exist
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/commands/loaddata.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index c95d11cf60..ab9f7468c4 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -4,6 +4,7 @@ import os import gzip import zipfile from optparse import make_option +import warnings from django.conf import settings from django.core import serializers @@ -162,9 +163,14 @@ class Command(BaseCommand): else: fixture_dirs = app_fixtures + list(settings.FIXTURE_DIRS) + [''] + label_found = False for fixture_dir in fixture_dirs: - self.process_dir(fixture_dir, fixture_name, compression_formats, - formats) + found = self.process_dir(fixture_dir, fixture_name, + compression_formats, formats) + label_found = label_found or found + + if fixture_name != 'initial_data' and not label_found: + warnings.warn("No fixture named '%s' found." % fixture_name) def process_dir(self, fixture_dir, fixture_name, compression_formats, serialization_formats): @@ -242,3 +248,5 @@ class Command(BaseCommand): raise CommandError( "No fixture data found for '%s'. (File format may be invalid.)" % (fixture_name)) + + return label_found |
