Ticket #4562: django_unique_together_exact.diff
File django_unique_together_exact.diff, 1.2 KB (added by , 17 years ago) |
---|
-
django/db/models/manipulators.py
281 281 from django.utils.text import get_text_list 282 282 field_list = [opts.get_field(field_name) for field_name in field_name_list] 283 283 if isinstance(field_list[0].rel, ManyToOneRel): 284 kwargs = {'%s__%s__ iexact' % (field_name_list[0], field_list[0].rel.field_name): field_data}284 kwargs = {'%s__%s__exact' % (field_name_list[0], field_list[0].rel.field_name): field_data} 285 285 else: 286 kwargs = {'%s__ iexact' % field_name_list[0]: field_data}286 kwargs = {'%s__exact' % field_name_list[0]: field_data} 287 287 for f in field_list[1:]: 288 288 # This is really not going to work for fields that have different 289 289 # form fields, e.g. DateTime. … … 296 296 if isinstance(f.rel, ManyToOneRel): 297 297 kwargs['%s__pk' % f.name] = field_val 298 298 else: 299 kwargs['%s__ iexact' % f.name] = field_val299 kwargs['%s__exact' % f.name] = field_val 300 300 try: 301 301 old_obj = self.manager.get(**kwargs) 302 302 except ObjectDoesNotExist: