Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed bug in metasystem manipulator_validator_unique_for_date(), rela…

…ted to [549]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2ce78063fa07ee3ebbae6eb5c00cc251b89da66f 1 parent 25aef18
Adrian Holovaty authored August 29, 2005

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  django/core/meta/__init__.py
6  django/core/meta/__init__.py
@@ -1613,7 +1613,11 @@ def manipulator_validator_unique_for_date(from_field, date_field, opts, lookup_t
1613 1613
     date_val = formfields.DateField.html2python(date_str)
1614 1614
     if date_val is None:
1615 1615
         return # Date was invalid. This will be caught by another validator.
1616  
-    lookup_kwargs = {'%s__iexact' % from_field.name: field_data, '%s__year' % date_field.name: date_val.year}
  1616
+    lookup_kwargs = {'%s__year' % date_field.name: date_val.year}
  1617
+    if isinstance(from_field.rel, ManyToOne):
  1618
+        lookup_kwargs['%s__pk' % from_field.name] = field_data
  1619
+    else:
  1620
+        lookup_kwargs['%s__iexact' % from_field.name] = field_data
1617 1621
     if lookup_type in ('month', 'date'):
1618 1622
         lookup_kwargs['%s__month' % date_field.name] = date_val.month
1619 1623
     if lookup_type == 'date':

0 notes on commit 2ce7806

Please sign in to comment.
Something went wrong with that request. Please try again.