#16151 closed Cleanup/optimization (worksforme)
More informative message than "No fixtures found"
Reported by: | Luc Saffre | Owned by: | nobody |
---|---|---|---|
Component: | Core (Serialization) | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When I run loaddata with a long list of fixture labels, and if for some of these there are no fixtures, then Django issues several times the message "No fixtures found." It would be more informative to mention the fixture name in that message. I suggest to change one line in django/core/management/commands/loaddata.py:
if fixture_object_count == 0: if verbosity >= 1: self.stdout.write("No fixtures found.\n")
Change this to:
if fixture_object_count == 0: if verbosity >= 1: self.stdout.write("No %r fixtures found.\n" % fixture_name)
Note:
See TracTickets
for help on using tickets.
I am unable to reproduce. That message is printed only once, if no objects are created from any fixture. Here's what I get:
The piece of code you're mentionning is outside of the main loop:
for fixture_label in fixture_labels: ...
;fixture_name
is leaked in scope from the last run of the loop. It's wrong to use it.