diff options
Diffstat (limited to 'django/core/management/commands/loaddata.py')
| -rw-r--r-- | django/core/management/commands/loaddata.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index c95d11cf60..fbafed3f92 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -162,9 +162,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: + raise CommandError("No fixture named '%s' found." % fixture_name) def process_dir(self, fixture_dir, fixture_name, compression_formats, serialization_formats): @@ -242,3 +247,5 @@ class Command(BaseCommand): raise CommandError( "No fixture data found for '%s'. (File format may be invalid.)" % (fixture_name)) + + return label_found |
