diff options
| author | Senko Rasic <senko.rasic@dobarkod.hr> | 2013-05-18 17:51:14 +0200 |
|---|---|---|
| committer | Senko Rasic <senko.rasic@dobarkod.hr> | 2013-05-19 10:56:09 +0200 |
| commit | cc3b3ba93a7bfdd2ece739e97e36150a719acd3e (patch) | |
| tree | 6a54337aa8f1ca72e1bb1bf1eefa3b09f09131f4 /django/core/management/commands/loaddata.py | |
| parent | 0a50311063c416ec4d39f518e8d8110dd7eddbdf (diff) | |
Fixed #18990: Loaddata now complains if fixture doesn't exist
The fixture named "initial_data" is exceptional though; if it
doesn't exist, the error is not raised. This allows syncdb and
flush management commands to attempt to load it without causing
an error if it doesn't exist.
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 |
