From 1ffddfc233e2d5139cc6ec31a4ec6ef70b10f87f Mon Sep 17 00:00:00 2001 From: belegnar Date: Wed, 3 Apr 2019 09:05:15 +0200 Subject: Fixed #30302 -- Fixed forms.model_to_dict() result if empty list of fields is passed. --- django/forms/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/forms') diff --git a/django/forms/models.py b/django/forms/models.py index d157c291ef..5edbbd376f 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -83,7 +83,7 @@ def model_to_dict(instance, fields=None, exclude=None): for f in chain(opts.concrete_fields, opts.private_fields, opts.many_to_many): if not getattr(f, 'editable', False): 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 -- cgit v1.3