mirror of
https://github.com/django/django.git
synced 2025-06-04 11:09:13 +00:00
Removed untouched branch in StateApps.__init__()
This commit is contained in:
parent
720ff740e7
commit
7a75ed1a4f
@ -212,22 +212,14 @@ class StateApps(Apps):
|
|||||||
|
|
||||||
self.render_multiple(list(models.values()) + self.real_models)
|
self.render_multiple(list(models.values()) + self.real_models)
|
||||||
|
|
||||||
# If there are some lookups left, see if we can first resolve them
|
# There shouldn't be any operations pending at this point.
|
||||||
# ourselves - sometimes fields are added after a model is registered
|
pending_models = set(self._pending_operations)
|
||||||
for lookup_model in self._pending_operations:
|
if ignore_swappable:
|
||||||
try:
|
pending_models -= {make_model_tuple(settings.AUTH_USER_MODEL)}
|
||||||
model = self.get_model(*lookup_model)
|
if pending_models:
|
||||||
except LookupError:
|
msg = "Unhandled pending operations for models: %s"
|
||||||
if lookup_model == make_model_tuple(settings.AUTH_USER_MODEL) and ignore_swappable:
|
labels = (".".join(model_key) for model_key in self._pending_operations)
|
||||||
continue
|
raise ValueError(msg % ", ".join(labels))
|
||||||
# Raise an error with a best-effort helpful message
|
|
||||||
# (only for the first issue). Error message should look like:
|
|
||||||
# "ValueError: Lookup failed for model referenced by
|
|
||||||
# field migrations.Book.author: migrations.Author"
|
|
||||||
msg = "Lookup failed for model: {model[0]}.{model[1]}"
|
|
||||||
raise ValueError(msg.format(model=lookup_model))
|
|
||||||
else:
|
|
||||||
self.do_pending_operations(model)
|
|
||||||
|
|
||||||
def render_multiple(self, model_states):
|
def render_multiple(self, model_states):
|
||||||
# We keep trying to render the models in a loop, ignoring invalid
|
# We keep trying to render the models in a loop, ignoring invalid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user