Refs #31051 -- Made dumpdata do not sort dependencies if natural foreign keys are not used.
There is no need to sort dependencies when natural foreign keys are not used.
This commit is contained in:
parent
4f216e4f8e
commit
2e67e80fbe
|
@ -144,7 +144,17 @@ class Command(BaseCommand):
|
|||
Collate the objects to be serialized. If count_only is True, just
|
||||
count the number of objects to be serialized.
|
||||
"""
|
||||
if use_natural_foreign_keys:
|
||||
models = serializers.sort_dependencies(app_list.items(), allow_cycles=True)
|
||||
else:
|
||||
# There is no need to sort dependencies when natural foreign
|
||||
# keys are not used.
|
||||
models = []
|
||||
for (app_config, model_list) in app_list.items():
|
||||
if model_list is None:
|
||||
models.extend(app_config.get_models())
|
||||
else:
|
||||
models.extend(model_list)
|
||||
for model in models:
|
||||
if model in excluded_models:
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue