mirror of https://github.com/django/django.git
Better error reporting when from_app_cache fails
This commit is contained in:
parent
4ca39684ee
commit
e9c6d04224
|
@ -99,11 +99,25 @@ class ModelState(object):
|
||||||
for field in model._meta.local_fields:
|
for field in model._meta.local_fields:
|
||||||
name, path, args, kwargs = field.deconstruct()
|
name, path, args, kwargs = field.deconstruct()
|
||||||
field_class = import_by_path(path)
|
field_class = import_by_path(path)
|
||||||
fields.append((name, field_class(*args, **kwargs)))
|
try:
|
||||||
|
fields.append((name, field_class(*args, **kwargs)))
|
||||||
|
except TypeError as e:
|
||||||
|
raise TypeError("Couldn't reconstruct field %s on %s: %s" % (
|
||||||
|
name,
|
||||||
|
model._meta.object_name,
|
||||||
|
e,
|
||||||
|
))
|
||||||
for field in model._meta.local_many_to_many:
|
for field in model._meta.local_many_to_many:
|
||||||
name, path, args, kwargs = field.deconstruct()
|
name, path, args, kwargs = field.deconstruct()
|
||||||
field_class = import_by_path(path)
|
field_class = import_by_path(path)
|
||||||
fields.append((name, field_class(*args, **kwargs)))
|
try:
|
||||||
|
fields.append((name, field_class(*args, **kwargs)))
|
||||||
|
except TypeError as e:
|
||||||
|
raise TypeError("Couldn't reconstruct m2m field %s on %s: %s" % (
|
||||||
|
name,
|
||||||
|
model._meta.object_name,
|
||||||
|
e,
|
||||||
|
))
|
||||||
# Extract the options
|
# Extract the options
|
||||||
options = {}
|
options = {}
|
||||||
for name in DEFAULT_NAMES:
|
for name in DEFAULT_NAMES:
|
||||||
|
|
Loading…
Reference in New Issue