diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-08-29 16:44:40 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-08-29 16:44:40 +0000 |
| commit | 2ce78063fa07ee3ebbae6eb5c00cc251b89da66f (patch) | |
| tree | 8e46ed09ede3f085855882b8f01547dc349038b2 | |
| parent | 25aef18d8358e7a89e99caf0c6b91f7179b6572b (diff) | |
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
| -rw-r--r-- | django/core/meta/__init__.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/core/meta/__init__.py b/django/core/meta/__init__.py index ea68ca59f9..9d807ed892 100644 --- a/django/core/meta/__init__.py +++ b/django/core/meta/__init__.py @@ -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': |
