Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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 adrianholovaty authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 django/core/meta/__init__.py
6 django/core/meta/__init__.py
View
@@ -1613,7 +1613,11 @@ def manipulator_validator_unique_for_date(from_field, date_field, opts, lookup_t
date_val = formfields.DateField.html2python(date_str)
if date_val is None:
return # Date was invalid. This will be caught by another validator.
- lookup_kwargs = {'%s__iexact' % from_field.name: field_data, '%s__year' % date_field.name: date_val.year}
+ lookup_kwargs = {'%s__year' % date_field.name: date_val.year}
+ if isinstance(from_field.rel, ManyToOne):
+ lookup_kwargs['%s__pk' % from_field.name] = field_data
+ else:
+ lookup_kwargs['%s__iexact' % from_field.name] = field_data
if lookup_type in ('month', 'date'):
lookup_kwargs['%s__month' % date_field.name] = date_val.month
if lookup_type == 'date':
Please sign in to comment.
Something went wrong with that request. Please try again.