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
This commit is contained in:
parent
472584b1f8
commit
cabf95daf9
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue