diff options
| author | Honza Král <honza.kral@gmail.com> | 2010-10-13 04:46:33 +0000 |
|---|---|---|
| committer | Honza Král <honza.kral@gmail.com> | 2010-10-13 04:46:33 +0000 |
| commit | 00a685178a6a8c1e2a3fe99ad20eb05d8533e175 (patch) | |
| tree | 6d887846a3b108b08a9185ab239105171d2e5890 /django/forms | |
| parent | 52716ddd1b0541b9cd86fd361a9f8b9894927211 (diff) | |
Fixed #14119 -- fields_for_model no longer returns all fields when fields parameter is the empty tuple. Thanks alexdutton!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14199 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/models.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py index d5d9fd1944..2f41dbf9df 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -40,7 +40,7 @@ def construct_instance(form, instance, fields=None, exclude=None): if not f.editable or isinstance(f, models.AutoField) \ or not f.name in cleaned_data: continue - if fields and f.name not in fields: + if fields is not None and f.name not in fields: continue if exclude and f.name in exclude: continue @@ -168,7 +168,7 @@ def fields_for_model(model, fields=None, exclude=None, widgets=None, formfield_c for f in opts.fields + opts.many_to_many: if not f.editable: continue - if fields and not f.name in fields: + if fields is not None and not f.name in fields: continue if exclude and f.name in exclude: continue |
