Fixed bug in manipulator_valid_rel_key -- it assumed the related object was related by the primary-key field, whereas this didn't work with ForeignKeys to non-primary-key fields
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3338 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
36e4e5a938
commit
0a2e8daaaf
|
@ -46,7 +46,7 @@ def manipulator_valid_rel_key(f, self, field_data, all_data):
|
|||
"Validates that the value is a valid foreign key"
|
||||
klass = f.rel.to
|
||||
try:
|
||||
klass._default_manager.get(pk=field_data)
|
||||
klass._default_manager.get(**{f.rel.field_name: field_data})
|
||||
except klass.DoesNotExist:
|
||||
raise validators.ValidationError, _("Please enter a valid %s.") % f.verbose_name
|
||||
|
||||
|
|
Loading…
Reference in New Issue