Merge pull request #159 from nephila/feature/fix_appconfig_wizard
Fix AppConfig selection in wizard
This commit is contained in:
commit
b706439d1f
2 changed files with 6 additions and 4 deletions
|
@ -16,9 +16,10 @@ try:
|
|||
default_appconfig = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if kwargs.get('initial', False):
|
||||
kwargs['initial']['app_config'] = self.default_appconfig
|
||||
if kwargs.get('data', False):
|
||||
if 'initial' not in kwargs or not kwargs.get('initial', False):
|
||||
kwargs['initial'] = {}
|
||||
kwargs['initial']['app_config'] = self.default_appconfig
|
||||
if 'data' in kwargs and kwargs['data'] is not None:
|
||||
kwargs['data']['1-app_config'] = self.default_appconfig
|
||||
super(PostWizardForm, self).__init__(*args, **kwargs)
|
||||
self.fields['app_config'].widget = forms.Select(
|
||||
|
|
|
@ -55,6 +55,7 @@ class WizardTest(BaseTest):
|
|||
for wiz in wizs:
|
||||
app_config = self.app_config_1.pk if wiz.title == 'New Blog' else self.app_config_2.pk
|
||||
form = wiz.form()
|
||||
self.assertTrue(form.initial.get('app_config', False), app_config)
|
||||
self.assertTrue(form.fields['app_config'].widget.attrs['disabled'])
|
||||
|
||||
form = wiz.form(data={
|
||||
|
@ -67,5 +68,5 @@ class WizardTest(BaseTest):
|
|||
self.assertTrue(form.cleaned_data['app_config'], app_config)
|
||||
|
||||
def test_wizard_import(self):
|
||||
# The following import should to fail in any django CMS version
|
||||
# The following import should not fail in any django CMS version
|
||||
from djangocms_blog import cms_wizards # NOQA
|
||||
|
|
Loading…
Reference in a new issue