mirror of
https://github.com/django/django.git
synced 2024-12-26 11:06:07 +00:00
Fixed bug in metasystem manipulator_validator_unique_for_date(), related to [549]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
25aef18d83
commit
2ce78063fa
@ -1613,7 +1613,11 @@ def manipulator_validator_unique_for_date(from_field, date_field, opts, lookup_t
|
|||||||
date_val = formfields.DateField.html2python(date_str)
|
date_val = formfields.DateField.html2python(date_str)
|
||||||
if date_val is None:
|
if date_val is None:
|
||||||
return # Date was invalid. This will be caught by another validator.
|
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'):
|
if lookup_type in ('month', 'date'):
|
||||||
lookup_kwargs['%s__month' % date_field.name] = date_val.month
|
lookup_kwargs['%s__month' % date_field.name] = date_val.month
|
||||||
if lookup_type == 'date':
|
if lookup_type == 'date':
|
||||||
|
Loading…
Reference in New Issue
Block a user