The publish_scheduled_pages management command does three actions:
* Gets live pages which have an expiry_datetime that has passed and set
expired = True and live = False
* Gets all revisions on the moderation queue which have an expiry_datetime
that has passed and remove them from the moderation queue
* Gets all revisions that have an approved_go_live_datetime that has
passed. For each one of them the publish() method of the revision is
called which will perform the required actions for making live this
version of the page.
Finally, a dryrun parameter has been added to the management command. If
this parameter is used then the pages that pass the tests for each of the
above lists will be printed.
The logic for publishing a page exists in the create and edit views of
wagtailadmin.views.pages and in the publish methodd of hte PageRevision
model.
When a page is created and published (create view), if it has a go_live
in the future then it will not be live but the revision that will be
created will have the approved_go_live set to the corresponding datetime.
If the page is just saved or submitted for moderation the normal flow
will be followed.
When a page is edited and published (edit view):
* The approved_go_live_datetime will be cleared for all older revisions of
that page.
* If the edit has a go_live in the future then the new revision that will
be crated will have the approved_go_live set to that datetime. Also the
live attribute of the page will be set to False.
If the page is edited and not published the normal flow will be followed.
When a submitted for moderation page is published (publish method):
* If it has a go_live in the future then the live attribute will be set to
False, the approved_go_live_datetime of the revision will be set to the
go_live_datetime of the page and the approved_go_live_datetime of all
other revisions will be cleared.
* If it does not have a go_live in the future then the page will be live
and the approved_go_live_dattime of all other revisions will be cleard
Finally, if a page is unpublished then then approved_go_live_datetime of
all revisions of that page will be cleared.
Also add a clean method to Page to check that expiry date is in the
future and that go live date is before expiry date. In order to display
the correct error message the views/pages.py view has to be changed to
display the error message from clean.
Finally add the migration for the new fields.
The 'preview' option is split out from the 'save' popup menu into its own button (it was deemed appropriate to split it off since it doesn't perform any database-level actions). If the page defines multiple page modes in get_page_modes, this button becomes a popup, allowing the editor to choose a mode. Finally, preview_on_create and preview_on_edit are updated to pass the chosen mode into the page's show_as_mode method.
a854c03f443083a1471dd066dece92527dbb7c7c improves the behaviour a lot, but it's
still fairly nasty for a text field to be rewriting text as you type it. It's
also unnecessary - you have to be pretty determined to submit the form without
triggering the blur event on the field, and if you do, all that happens is that
you fail server-side validation.
quality. Uses an IMAGE_COMPRESSION_QUALITY in the settings.py, which, if
set, will set a quality attribute in the image processing backends. Each
image processing backend then can use the quality attribute in its "save"
method.
This has been implemented in both Pillow and Wand backends. It has been
tested with image that support this setting (JPG) and images that do not
support it (GIF, PNG) and the behavior is consistent.
This is an implementation for #163.