From 4c102f69b72164e0f9cbd6d1d5fb8095d3e5a4bd Mon Sep 17 00:00:00 2001 From: Ross Blair Date: Mon, 3 Oct 2016 20:52:36 -0700 Subject: [PATCH] modelformset factory queryset needs an empty queryset not just a None to not populate the formaset with the default data --- open_fmri/apps/dataset/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/open_fmri/apps/dataset/views.py b/open_fmri/apps/dataset/views.py index 750807e..6abd586 100644 --- a/open_fmri/apps/dataset/views.py +++ b/open_fmri/apps/dataset/views.py @@ -142,10 +142,12 @@ def get_context_data(self, **kwargs): context['revision_formset_helper'] = RevisionFormSetHelper() if self.object: context['contact_formset'] = ContactFormSet( - queryset=self.object.contacts.all(), + queryset=object.contacts.all(), ) else: - context['contact_formset'] = ContactFormSet() + context['contact_formset'] = ContactFormSet( + queryset=Contact.objects.none() + ) context['contact_formset_helper'] = ContactFormSetHelper() return context