From cabf95daf96f7d8c070c6de867b2979d8bbf7f66 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Sat, 27 Jun 2020 17:21:57 +0000 Subject: [PATCH] Fixed an issue where a session was saved without a type_id, found by the Django 2.2 checks. The code set the value just after the first save, and then did a second save, but this is 1) more costly, and 2) keeps an invalid session object in the database for a short time. - Legacy-Id: 18084 --- ietf/meeting/forms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ietf/meeting/forms.py b/ietf/meeting/forms.py index 9818f7b2a..2a37c2e3e 100644 --- a/ietf/meeting/forms.py +++ b/ietf/meeting/forms.py @@ -250,9 +250,11 @@ class InterimSessionModelForm(forms.ModelForm): def save(self, *args, **kwargs): """NOTE: as the baseform of an inlineformset self.save(commit=True) never gets called""" - session = super(InterimSessionModelForm, self).save(commit=kwargs.get('commit', True)) + session = super(InterimSessionModelForm, self).save(commit=False) session.group = self.group session.type_id = 'regular' + if kwargs.get('commit', True) is True: + super(InterimSessionModelForm, self).save(commit=True) return session def save_agenda(self):