You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/advanced_configuration.rst
+58-46Lines changed: 58 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,10 @@ with different options.
15
15
Adding to the context of versioning admin views
16
16
------------------------------------------------
17
17
18
-
Currently versioning supports adding context variables to the unpublish confirmation view. Wider support for adding context variables is planned, but at the moment only the unpublish confirmation view is supported. This is how one would configure this in `cms_config.py`:
18
+
Currently versioning supports adding context variables to the unpublish confirmation
19
+
view. Wider support for adding context variables is planned, but at the moment only
20
+
the unpublish confirmation view is supported. This is how one would configure this
21
+
in ```cms_config.py```:
19
22
20
23
.. code-block:: python
21
24
@@ -35,12 +38,16 @@ Currently versioning supports adding context variables to the unpublish confirma
35
38
}
36
39
37
40
38
-
Any context variable added to this setting will be displayed on the unpublish confirmation page automatically, but if you wish to change where on the page it displays, you will need to override the `djangocms_versioning/admin/unpublish_confirmation.html` template.
41
+
Any context variable added to this setting will be displayed on the unpublish confirmation
42
+
page automatically, but if you wish to change where on the page it displays, you will
43
+
need to override the `djangocms_versioning/admin/unpublish_confirmation.html` template.
39
44
40
45
41
46
Additional options on the VersionableItem class
42
47
-------------------------------------------------
43
-
The three mandatory attributes of `VersionableItem` are described in detail on the :doc:`versioning_integration` page. Below are additional options you might want to set.
48
+
The three mandatory attributes of :class:`~djangocms_versioning.datastructures.VersionableItem`
49
+
are described in detail on the :doc:`versioning_integration` page. Below are additional
50
+
options you might want to set.
44
51
45
52
46
53
.. _preview_url:
@@ -75,7 +82,8 @@ This will define the url that will be used for each version on the version list
75
82
76
83
extra_grouping_fields
77
84
++++++++++++++++++++++
78
-
Defines one or more :term:`extra grouping fields <extra grouping field>`. This will add a UI filter to the version list table enabling filtering by that field.
85
+
Defines one or more :term:`extra grouping fields <extra grouping field>`. This will add a
86
+
UI filter to the version list table enabling filtering by that field.
79
87
80
88
.. code-block:: python
81
89
@@ -98,7 +106,8 @@ Defines one or more :term:`extra grouping fields <extra grouping field>`. This w
98
106
99
107
version_list_filter_lookups
100
108
++++++++++++++++++++++++++++
101
-
Must be defined if the :ref:`extra_grouping_fields` option has been set. This will let the UI filter know what values it should allow filtering by.
109
+
Must be defined if the :ref:`extra_grouping_fields` option has been set. This will let the
110
+
UI filter know what values it should allow filtering by.
102
111
103
112
.. code-block:: python
104
113
@@ -121,12 +130,14 @@ Must be defined if the :ref:`extra_grouping_fields` option has been set. This wi
121
130
grouper_selector_option_label
122
131
++++++++++++++++++++++++++++++
123
132
124
-
If the version table link is specified without a grouper param, a form with a dropdown of grouper objects will display. By default, if the grouper object is registered with the
133
+
If the version table link is specified without a grouper param, a form with a dropdown
134
+
of grouper objects will display. By default, if the grouper object is registered with the
125
135
admin and has a ``search_fields`` attribute, the dropdown will be an autocomplete
126
136
field which will display the object's ``__str__`` method. This is the recommended
127
137
method.
128
138
129
-
For models not registerd with the admin, or without search fields, this setting defines how the labels of those groupers will display on the dropdown (regular select field).
139
+
For models not registerd with the admin, or without search fields, this setting defines
140
+
how the labels of those groupers will display on the dropdown (regular select field).
130
141
131
142
132
143
.. code-block:: python
@@ -152,7 +163,8 @@ For models not registerd with the admin, or without search fields, this setting
152
163
153
164
content_admin_mixin
154
165
++++++++++++++++++++
155
-
Versioning modifies how the admin of the :term:`content model <content model>` works with `VersioningAdminMixin`. But you can modify this mixin with this setting.
166
+
Versioning modifies how the admin of the :term:`content model <content model>` works with
167
+
:class:`~djangocms-versioning.admin.VersioningAdminMixin`. But you can modify this mixin with this setting.
156
168
157
169
.. code-block:: python
158
170
@@ -179,44 +191,44 @@ Versioning modifies how the admin of the :term:`content model <content model>` w
179
191
),
180
192
]
181
193
182
-
grouper_admin_mixin
183
-
++++++++++++++++++++
184
-
This option allows you to customize the admin interface for the
185
-
:term:`grouper model <grouper model>` by providing a custom ModelAdmin mixin.
186
-
By default, versioning uses the standard admin, but you can override or extend
187
-
its behavior using this setting.
188
-
189
-
To use, define your mixin classandset it on the `VersionableItem`:
190
-
191
-
.. code-block:: python
192
-
193
-
# some_app/cms_config.py
194
-
from cms.app_base import CMSAppConfig
195
-
from djangocms_versioning.datastructures import VersionableItem
196
-
197
-
class CustomGrouperAdminMixin:
198
-
# Override ModelAdmin methods or attributes as needed
Copy file name to clipboardExpand all lines: docs/introduction/versioning_integration.rst
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,8 +113,12 @@ which we have used is sufficient, but in many cases you might need to write your
113
113
114
114
Once a model is registered for versioning its behaviour changes:
115
115
116
-
1. It's default manager (``Model.objects``) only sees published versions of the model. See :term:``content model``.
117
-
2. It's ``Model.objects.create`` method now will not only create the :term:`content model` but also a corresponding ``Version`` model. Since the ``Version`` model requires a ``User`` object to track who created which version the correct way of creating a versioned :term:`content model` is::
116
+
1. It's default manager (``Model.objects``) only sees published versions of the model.
117
+
See :term:``content model``.
118
+
2. It's ``Model.objects.create`` method now will not only create the :term:`content model`
119
+
but also a corresponding ``Version`` model. Since the ``Version`` model requires a
120
+
``User`` object to track who created which version the correct way of creating a
0 commit comments