Commit 08081f26 authored by Nicolas Joyard's avatar Nicolas Joyard

Fix exception when adding model with themes

parent 7b1382a0
......@@ -49,15 +49,12 @@ class ThemedAdminForm(forms.ModelForm):
def save(self, commit=True):
item = super(ThemedAdminForm, self).save(commit=False)
item.save()
if commit:
item.save()
item.themes = self.cleaned_data['themes']
self.save_m2m()
if item.pk:
item.themes = self.cleaned_data['themes']
self.save_m2m()
return item
return item
class ThemedDossierAdminForm(ThemedAdminForm):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment