From 51c8126e045318b60be3e58e632b21e70ed64aff Mon Sep 17 00:00:00 2001 From: Sounak Pradhan Date: Sat, 1 Jun 2019 21:33:31 +0530 Subject: [PATCH] Override clean function for wizard blog form --- gsoc/cms_wizards.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gsoc/cms_wizards.py b/gsoc/cms_wizards.py index 3a08f2fd..ceb2acce 100644 --- a/gsoc/cms_wizards.py +++ b/gsoc/cms_wizards.py @@ -81,11 +81,15 @@ def __init__(self, **kwargs): choices=app_config_choices ) + def clean(self): + cd = self.cleaned_data + app_config = NewsBlogConfig.objects.get(pk=self.cleaned_data['app_config']) + cd['app_config'] = app_config + return cd + def save(self, commit=True): article = super(CreateNewsBlogArticleForm, self).save(commit=False) article.owner = self.user - article.app_config = NewsBlogConfig.objects.\ - filter(pk=self.cleaned_data['app_config']).first() article.is_published = True article.save() return article