Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve scheduled publishing docs #9263

Merged
merged 2 commits into from
Sep 30, 2022

Conversation

laymonage
Copy link
Member

I forgot (sorry!) to document that it's required to include PublishingPanel() in the snippet model's panels definition in order to use the scheduled publishing feature introduced in #8976.

This PR also improves the docs on how the schedule publishing mechanism works in Wagtail. Most notable change is that we should explicitly state that clicking "Publish" is required for the schedule to actually be scheduled.

I also added some explanations regarding some edge cases for scheduled publishing when an unpublishing schedule has already been set. Not sure if it's worth explaining this one, but I think it's better than not knowing what happens.

Explicitly state that clicking Publish is required for the schedule to take effect.

Also document the edge cases for scheduled publishing when a page is scheduled to be unpublished
@squash-labs
Copy link

squash-labs bot commented Sep 29, 2022

Manage this branch in Squash

Test this branch here: https://laymonagesnippets-schedule-pub-safa0.squash.io

@laymonage laymonage changed the title Improve schedule publishing docs Improve scheduled publishing docs Sep 29, 2022
@gasman
Copy link
Collaborator

gasman commented Sep 29, 2022

I'm sure I saw a line that added PublishingPanel to DraftStateMixin snippets automatically - did that get removed for the final version of #8976?

Incidentally, I did notice a related quirk when testing this on bakerydemo - I tried it on the Country model, which doesn't define a panels attribute, and so Wagtail supplies a default one consisting of an ObjectList with FieldPanels for all editable fields. On adding DraftStateMixin, this caused the go-live / expiry date fields to show up in the main body of the form. I did wonder about fixing that by setting those fields to editable=False, but figured that: 1) that might cause bigger side effects elsewhere; 2) this quirk will only surface when first adding DraftStateMixin to a model, and the fix is obvious; and 3) I'm not sure if omitting panels is even an officially supported setup...

@laymonage
Copy link
Member Author

laymonage commented Sep 30, 2022

I'm sure I saw a line that added PublishingPanel to DraftStateMixin snippets automatically - did that get removed for the final version of #8976?

Incidentally, I did notice a related quirk when testing this on bakerydemo - I tried it on the Country model, which doesn't define a panels attribute, and so Wagtail supplies a default one consisting of an ObjectList with FieldPanels for all editable fields. On adding DraftStateMixin, this caused the go-live / expiry date fields to show up in the main body of the form. I did wonder about fixing that by setting those fields to editable=False, but figured that: 1) that might cause bigger side effects elsewhere; 2) this quirk will only surface when first adding DraftStateMixin to a model, and the fix is obvious;

Ah yes, I did remove the line that added PublishingPanel because I remembered having a discussion with Karl and Jacob and we thought that it'd be better to explicitly require the PublishingPanel() instead of it being magically added somewhere by Wagtail.

and 3) I'm not sure if omitting panels is even an officially supported setup...

I think the snippets docs always explicitly show the panels definition in the models. In addition, we added the following admonition to the docs in 4.0:

```{note}
The `DraftStateMixin` includes fields used by Wagtail's publishing mechanism that may currently be inapplicable for snippets. For example, the scheduled publishing fields (i.e. `go_live_at`, `expire_at`, and `expired`) are added to snippet models that inherit from the mixin, but the scheduled publishing feature itself is not yet officially supported for snippets.
We are introducing these fields early to make adding new features easier in the future. Until the features become available and officially supported, we recommend explicitly defining the `panels` in your snippets with only your relevant model fields.
```

@gasman gasman merged commit 57beeb7 into wagtail:main Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants