Ticket #1592: related_with_limit_choices.diff
File related_with_limit_choices.diff, 578 bytes (added by , 19 years ago) |
---|
-
django/db/models/fields/related.py
a b class ReverseSingleRelatedObjectDescript 132 132 params = {'%s__pk' % self.field.rel.field_name: val} 133 133 else: 134 134 params = {'%s__exact' % self.field.rel.field_name: val} 135 if self.field.rel.limit_choices_to: 136 params.update(self.field.rel.limit_choices_to) 135 137 rel_obj = self.field.rel.to._default_manager.get(**params) 136 138 setattr(instance, cache_name, rel_obj) 137 139 return rel_obj