Search code examples
django-cms

django-cms: Can I publish all pages in one step


In django-cms, if I have done a lot of changes in different pages and added new pages, is there any alterative to clicking "publish" on each page separately?


Solution

  • Yeah there is a management command just for this scenario.

    cms publisher-publish
    

    It accepts the following options

    • --unpublished: set to publish all drafts, including unpublished ones; if not set, only already published pages will be republished.
    • -l, --language: specify a language code to publish pages in only one language; if not specified, this command publishes all page languages;
    • --site: specify a site id to publish pages for specified site only; if not specified, this command publishes pages for all sites;

    Examples;

    #publish drafts for public pages in all languages
    cms publisher-publish
    
    #publish all drafts in all pages
    cms publisher-publish --unpublished
    
    #publish drafts for public pages in deutsch
    cms publisher-publish --language=de
    
    #publish all drafts in deutsch
    cms publisher-publish --unpublished --language=de
    
    #publish all drafts in deutsch, but only for site with id=2
    cms publisher-publish --unpublished --language=de --site=2
    

    The full docs for this can be found here; http://docs.django-cms.org/en/latest/reference/cli.html#cms-publisher-publish