File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ Changelog
4
4
5
5
Unreleased
6
6
==================
7
+ * feat: Exposed the setting DJANGOCMS_SNIPPET_VERSIONING_MIGRATION_USER_ID as an environment variable for the Divio addon
7
8
* fix: Error when rendering a Draft Snippet plugin on a Published page
8
9
* fix: Publish snippets by default as they were already in that state pre-versioning and cleanup unnecessary migration files before release!
9
10
* feat: djangocms-versioning support added, including model restructure and configuration
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ please set ``DJANGOCMS_SNIPPET_CACHE`` to ``False`` in your settings::
82
82
83
83
Migration 0010 requires the use of a user in order to create versions for existing snippets (if djangocms_versioning is installed and enabled),
84
84
a user can be chosen with the setting ``DJANGOCMS_SNIPPET_VERSIONING_MIGRATION_USER_ID ``, the default is 1.
85
+ This setting is also exposed as an Environment variable for Divio projects using the Divio addon.
85
86
86
87
DJANGOCMS_SNIPPET_VERSIONING_MIGRATION_USER_ID = 2 # Will use user with id: 2
87
88
Original file line number Diff line number Diff line change
1
+ from functools import partial
2
+
1
3
from aldryn_client import forms
2
4
3
5
@@ -17,6 +19,18 @@ class Form(forms.BaseForm):
17
19
)
18
20
19
21
def to_settings (self , data , settings ):
22
+ from aldryn_addons .utils import djsenv
23
+
24
+ env = partial (djsenv , settings = settings )
25
+
26
+ # Get a migration user if the env setting has been added
27
+ migration_user_id = env (
28
+ 'DJANGOCMS_SNIPPET_VERSIONING_MIGRATION_USER_ID' ,
29
+ default = False
30
+ )
31
+ if migration_user_id :
32
+ settings ['DJANGOCMS_SNIPPET_VERSIONING_MIGRATION_USER_ID' ] = int (migration_user_id )
33
+
20
34
if data ['editor_theme' ]:
21
35
settings ['DJANGOCMS_SNIPPET_THEME' ] = data ['editor_theme' ]
22
36
if data ['editor_mode' ]:
You can’t perform that action at this time.
0 commit comments