Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improve error message for bad FK resolution

  • Loading branch information...
commit ade34c44dae4f5cf9d51bf7f900bf06efa98ff12 1 parent 6e21a59
@andrewgodwin andrewgodwin authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  django/db/models/fields/related.py
View
2  django/db/models/fields/related.py
@@ -958,6 +958,8 @@ def __init__(self, to, from_fields, to_fields, **kwargs):
def resolve_related_fields(self):
if len(self.from_fields) < 1 or len(self.from_fields) != len(self.to_fields):
raise ValueError('Foreign Object from and to fields must be the same non-zero length')
+ if isinstance(self.rel.to, basestring):
+ raise ValueError('Related model %r cannot been resolved' % self.rel.to)
related_fields = []
for index in range(len(self.from_fields)):
from_field_name = self.from_fields[index]
Please sign in to comment.
Something went wrong with that request. Please try again.