Replies: 4 comments 7 replies
-
This sounds worthwhile/necessary but certainly complex. I also really think we should provide a way for integrating projects to run the status checking outside of web requests. A management command would work best as that could call a utility function like you're taking about. That way celery or cron could be used to call the same function. |
Beta Was this translation helpful? Give feedback.
-
I think we can potentially reduce the complexity a bit: Maybe rename those fields to
This way no state has to be changed in the background, those datetime fields do not have to be editable. Overlapping visibilities cannot happen (to create a new timed published version, a previously published version will have to be unpublished first). No precedences have to be defined and explained. I'd suggest adding a "Timed publishing..." menu entry for drafts to the versioning menu, which then allows for those two datetimes to be defined in a form. Finally, this would in principle also be integrable with moderation. PS: We would need to think about menu caching to ensure content also appears in the menu. |
Beta Was this translation helpful? Give feedback.
-
This requirement was spec'd by the V4 sponsor early on, it was superseded by an internal third party tool. The original spec was The design philosophy of V4 is to create something complex with many simple things. What happens is that Scheduled publishing comes with some very interesting problems, it needs moderation support (sign off before publishing) and it's also difficult to know what to do in some cases when unpublishing content "expires" because it can leave a page looking broken (think alias on a page here). Scheduled publishing was also another driving factor for |
Beta Was this translation helpful? Give feedback.
-
To discuss this with a concrete implementation at hand, I have created PR #341 to show how the V4 philosophy on separating out functionality allows implementing start and end dates easily with versioning. It automatically becomes available for all versioned models, like alias or blog (soon). I'd appreciate your thoughts! |
Beta Was this translation helpful? Give feedback.
-
In CMS3, each page had a
publish_date
and apublish_end_date
so that pages could appear and disappear after those given timestamps. CMS4 doesn't offer such a feature anymore. We however need this, because some press releases have a time constraint and must not be published before a certain timestamp.On 2023-06-21 I chatted with @fsbraun about this issue and asked him how to solve this. I actually was thinking about extending
PageContent
with a custom class, and add those two fields there. Fabian however convinced me to add this feature directly into djangocms-versioning.There this feature is in good hands, because apparently even the django-cms blog requires this. So how do we proceed?
Proposal:
Extend model
Version
and add two optional timestampspublish_at
andunpublish_at
. If they areNone
the behavior remains unchanged.None
in this context means that a page-content is published immediately and indefinitely.If the page-content is versioned, these rules apply:
A
Version
object with a timestamp has precedence over a version without a timestamp. This rule only applies if the time constraint is active and the state is either "Pending" or "Expired" (see below). Example:published_at
orunpublish_at
.published_at
andunpublish_at
, both in the future. After saving Version 2, the status would show "Unpublished", be the list view ofVersionAdmin
then renders "Pending" which is more meaningful.published_at
in Version 2.unpublished_at
in Version 2.In Column "Status", the list view shows two more states, "Pending" and "Expired". These are just more meaningful values for "Unpublished" and can be determined using the timestamp values
publish_at
andunpublish_at
. Thestate
field in modelVersion
then still has the value "Unpublished". Versions with status "Pending" or "Expired" behave just like pages with status "Unpublished". They can be reverted by clicking on the "Revert" action inside the versioning's list view.Currently there is no editor to change any field value of a version object. Here we could add a detail (change) view to the list view when clicking on "Manage Versions…". This detail view is realized inside the existing VersionAdmin. It only contains the fields
publish_at
andunpublish_at
. Are the proposals for other fields to be added?The value for
published_at
must either beNone
, or precede the value forunpublish_at
. The same applies forunpublished_at
.If a page-content contains more than one
Version
object, no two version objects may have overlapping publishing dates. This rule is enforced through a validation checker when validating a Version object before saving theVersionAdmin
change view.If all versions have time constraints and none of them is currently active, a Not-Found page is rendered.
We need four extra icons to symbolize versions with either
publish_at
orunpublish_at
, both of them, or none of them. They shall be rendered in the list view.Since we do not want to install an asynchronous running worker (for instance Celery) which sets the status (
state
field in modelVersion
) whenever a configured timestamp is reached, this will be done by a specialstatus_update()
-method. This method will be invoked before rendering a page or the list view for versions but could also be invoked from outside by whomever needs it.Beta Was this translation helpful? Give feedback.
All reactions