def manipulator_valid_rel_key(f, self, field_data, all_data):
 klass = f.rel.to
 try:
  klass._default_manager.get(**{f.rel.field_name: field_data})
 except klass.DoesNotExist:
  raise validators.ValidationError, (_('Please enter a valid %s.') % f.verbose_name)

def manipulator_valid_rel_key ( f , self , field_data , all_data ) : klass = f . rel . to try : klass . _default_manager . get ( ** { f . rel . field_name : field_data } ) except klass . DoesNotExist : raise validators . ValidationError , ( _ ( 'Please enter a valid %s.' ) % f . verbose_name )
validates that the value is a valid foreign key .