Ticket #14691: multidb_foreignkey_validation_patch.diff
File multidb_foreignkey_validation_patch.diff, 796 bytes (added by , 14 years ago) |
---|
-
django/db/models/fields/related.py
834 834 super(ForeignKey, self).validate(value, model_instance) 835 835 if value is None: 836 836 return 837 838 qs = self.rel.to._default_manager.filter(**{self.rel.field_name:value}) 837 838 using = router.db_for_read(model_instance.__class__, instance=model_instance) 839 qs = self.rel.to._default_manager.using(using).filter(**{self.rel.field_name:value}) 839 840 qs = qs.complex_filter(self.rel.limit_choices_to) 840 841 if not qs.exists(): 841 842 raise exceptions.ValidationError(self.error_messages['invalid'] % {