Code

Ticket #5895: perf_fix.diff

File perf_fix.diff, 589 bytes (added by Karen Tracey <kmtracey@…>, 7 years ago)
Line 
1Index: django/newforms/models.py
2===================================================================
3--- django/newforms/models.py   (revision 6658)
4+++ django/newforms/models.py   (working copy)
5@@ -264,7 +264,7 @@
6 
7     def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None):
8         kwargs = {'data': data, 'files': files, 'auto_id': auto_id, 'prefix': prefix}
9-        if self.queryset:
10+        if self.queryset is not None:
11             kwargs['initial'] = [initial_data(obj) for obj in self.get_queryset()]
12         super(BaseModelFormSet, self).__init__(**kwargs)
13