Ticket #4562: django_unique_together_exact.diff

File django_unique_together_exact.diff, 1.2 KB (added by calvin@…, 12 years ago)
  • django/db/models/manipulators.py

     
    281281    from django.utils.text import get_text_list
    282282    field_list = [opts.get_field(field_name) for field_name in field_name_list]
    283283    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}
    285285    else:
    286         kwargs = {'%s__iexact' % field_name_list[0]: field_data}
     286        kwargs = {'%s__exact' % field_name_list[0]: field_data}
    287287    for f in field_list[1:]:
    288288        # This is really not going to work for fields that have different
    289289        # form fields, e.g. DateTime.
     
    296296        if isinstance(f.rel, ManyToOneRel):
    297297            kwargs['%s__pk' % f.name] = field_val
    298298        else:
    299             kwargs['%s__iexact' % f.name] = field_val
     299            kwargs['%s__exact' % f.name] = field_val
    300300    try:
    301301        old_obj = self.manager.get(**kwargs)
    302302    except ObjectDoesNotExist:
Back to Top