mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #1662 -- Added resolver for string-form model references for models that have already been loaded, with tests to validate both forward and backward referenced model names. Light refactoring of model loading to make regression tests behave more like normal model loading. Also clarifies the text of some validation errors.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3195 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -855,7 +855,7 @@ def get_validation_errors(outfile, app=None):
|
||||
if f.rel:
|
||||
rel_opts = f.rel.to._meta
|
||||
if f.rel.to not in models.get_models():
|
||||
e.add(opts, "'%s' has relation with uninstalled model %s" % (f.name, rel_opts.object_name))
|
||||
e.add(opts, "'%s' has relation with model %s, which has not been installed" % (f.name, rel_opts.object_name))
|
||||
|
||||
rel_name = RelatedObject(f.rel.to, cls, f).get_accessor_name()
|
||||
for r in rel_opts.fields:
|
||||
@@ -876,7 +876,7 @@ def get_validation_errors(outfile, app=None):
|
||||
# existing fields, m2m fields, m2m related objects or related objects
|
||||
rel_opts = f.rel.to._meta
|
||||
if f.rel.to not in models.get_models():
|
||||
e.add(opts, "'%s' has m2m relation with uninstalled model %s" % (f.name, rel_opts.object_name))
|
||||
e.add(opts, "'%s' has m2m relation with model %s, which has not been installed" % (f.name, rel_opts.object_name))
|
||||
|
||||
rel_name = RelatedObject(f.rel.to, cls, f).get_accessor_name()
|
||||
for r in rel_opts.fields:
|
||||
|
||||
Reference in New Issue
Block a user