1010
1111class StoriesCMSConfig (CMSAppConfig ):
1212 cms_enabled = True
13- cms_toolbar_enabled_models = [(PostContent , ToolbarDetailView .as_view ())]
13+ cms_toolbar_enabled_models = [(PostContent , ToolbarDetailView .as_view (), "post" )]
1414 djangocms_versioning_enabled = (
1515 getattr (settings , "VERSIONING_BLOG_MODELS_ENABLED" , True ) and djangocms_versioning_installed
1616 )
17-
18- @property
19- def cms_wizards (self ):
20- from django .utils .translation import gettext
21- from django .utils .functional import lazy
22-
23- from .cms_appconfig import StoriesConfig
24- from .cms_wizards import PostWizard , PostWizardForm
25-
26- for item , config in enumerate (StoriesConfig .objects .all ().order_by ("namespace" ), start = 1 ):
27- seed = f"Story{ item } Wizard"
28- new_wizard = type (str (seed ), (PostWizard ,), {})
29- new_form = type ("{}Form" .format (seed ), (PostWizardForm ,), {"default_appconfig" : config .pk })
30- yield new_wizard (
31- title = lazy (lambda config = config : gettext ("New {0}" ).format (config .object_name ), str )(),
32- weight = 200 ,
33- form = new_form ,
34- model = PostContent ,
35- description = lazy (lambda config = config : gettext ("Create a new {0} in {1}" ).format (config .object_name , config .app_title ), str )(),
36- )
37-
3817 if djangocms_versioning_enabled :
3918 from packaging .version import Version as PackageVersion
4019 from cms .utils .i18n import get_language_tuple
@@ -57,3 +36,24 @@ def cms_wizards(self):
5736 copy_function = default_copy ,
5837 ),
5938 ]
39+
40+ @property
41+ def cms_wizards (self ):
42+ from django .utils .translation import gettext
43+ from django .utils .functional import lazy
44+
45+ from .cms_appconfig import StoriesConfig
46+ from .cms_wizards import PostWizard , PostWizardForm
47+
48+ for item , config in enumerate (StoriesConfig .objects .all ().order_by ("namespace" ), start = 1 ):
49+ seed = f"Story{ item } Wizard"
50+ new_wizard = type (str (seed ), (PostWizard ,), {})
51+ new_form = type ("{}Form" .format (seed ), (PostWizardForm ,), {"default_appconfig" : config .pk })
52+ yield new_wizard (
53+ title = lazy (lambda config = config : gettext ("New {0}" ).format (config .object_name ), str )(),
54+ weight = 200 ,
55+ form = new_form ,
56+ model = PostContent ,
57+ description = lazy (lambda config = config : gettext ("Create a new {0} in {1}" ).format (config .object_name , config .app_title ), str )(),
58+ )
59+
0 commit comments