mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #22025 -- Listing app followed by app.Model in dumpdata command
When invoked as follows: $ python manage.py dumpdata blogapp blogapp.Tag Django would throw a TypeError. This commit fixes the problem and provides a test.
This commit is contained in:
committed by
Baptiste Mispelon
parent
e0381cdf2e
commit
73f51e4113
@@ -102,8 +102,13 @@ class Command(BaseCommand):
|
||||
raise CommandError("Unknown model: %s.%s" % (app_label, model_label))
|
||||
|
||||
app_list_value = app_list.setdefault(app_config, [])
|
||||
if model not in app_list_value:
|
||||
app_list_value.append(model)
|
||||
|
||||
# We may have previously seen a "all-models" request for
|
||||
# this app (no model qualifier was given). In this case
|
||||
# there is no need adding specific models to the list.
|
||||
if app_list_value is not None:
|
||||
if model not in app_list_value:
|
||||
app_list_value.append(model)
|
||||
except ValueError:
|
||||
if primary_keys:
|
||||
raise CommandError("You can only use --pks option with one model")
|
||||
|
||||
Reference in New Issue
Block a user