From 00a685178a6a8c1e2a3fe99ad20eb05d8533e175 Mon Sep 17 00:00:00 2001 From: Honza Král Date: Wed, 13 Oct 2010 04:46:33 +0000 Subject: 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 --- django/forms/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'django/forms') 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 -- cgit v1.3