diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-17 07:07:28 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-17 07:07:28 +0000 |
| commit | 015d85aee64ed8b020c38b2ada55d8aaba0608eb (patch) | |
| tree | b302847c4b5dbcf17ba69d8c6058d8538121e56f /django | |
| parent | 810ed2b22be663660d2ad56a43357c9a0378d7df (diff) | |
Fixed #14102 -- Ensure that fields that have been excluded from a form aren't included in the unique_for_* checks, either. Thanks to Travis Cline for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13598 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/base.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py index 07fc501ea0..1927b1eb2a 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -1,6 +1,5 @@ import types import sys -import os from itertools import izip import django.db.models.manager # Imported to register signal handler. from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS @@ -16,7 +15,7 @@ from django.db.models.loading import register_models, get_model from django.utils.translation import ugettext_lazy as _ import django.utils.copycompat as copy from django.utils.functional import curry, update_wrapper -from django.utils.encoding import smart_str, force_unicode, smart_unicode +from django.utils.encoding import smart_str, force_unicode from django.utils.text import get_text_list, capfirst from django.conf import settings @@ -744,11 +743,11 @@ class Model(object): continue if f.unique: unique_checks.append((model_class, (name,))) - if f.unique_for_date: + if f.unique_for_date and f.unique_for_date not in exclude: date_checks.append((model_class, 'date', name, f.unique_for_date)) - if f.unique_for_year: + if f.unique_for_year and f.unique_for_year not in exclude: date_checks.append((model_class, 'year', name, f.unique_for_year)) - if f.unique_for_month: + if f.unique_for_month and f.unique_for_month not in exclude: date_checks.append((model_class, 'month', name, f.unique_for_month)) return unique_checks, date_checks |
