Skip to main content

A drop-in enhancement for Django's contrib.flatpages

Project description

Django Flatpages Plus

A drop-in replacement for Django's contrib.flatpages

Features

  • More descriptive page history: no more vague "Changed Content."!
  • Preview changes before they go live
  • Revert changes after they've been published

Compatibility

flatpages_extra should compatible with all curently supported versions of Python and Django.

Installation

First make sure the package is installed:

pip install django-flatpages-extra

Then add flatpages_extra to your settings.INSTALLED_APPS, making sure it comes before contrib.flatpages:

# settings.py
INSTALLED_APPS = [
    ...
    "flatpages_extra",
    "contrib.flatpages",
    ...
]

Finally, include the URL configuration. The exact path doesn't matter as long as it's reachable somewhere:

# urls.py
urlpatters = [
    ...
    # Replace `flatpagesextra` with whatever you'd like:
    path("flatpagesextra/", include("flatpages_extra.urls")),
    ...
]

Once you've done all that, the app should be installed and running. Optionally you can run this command to import data from contrib.flatpages:

python manage.py flatpages_extra_import_initial

Running this command will do the following:

  • create initial Revisions for all existing flatpages;
  • copy the pages' history from contrib.flatpages (otherwise the "History" page in the admin would be empty);
  • copy any custom FlatPage permission;
  • copy user and group permissions.

How to use it

flatpages_extra is meant to be used from the Django admin. Once installed, it replaces Django's contrib.flatpages in the admin interface with its own. When you want to make changes to an existing page, create a new revision (the FlatPage change form will prompt you to do so). Once a revision is created, you can make changes to it, preview it, and even share the preview link. When you're happy with the changes, you can publish the revision via the "publish" button on the Revision changelist. Publishing a revision will automatically update the related page's content and create a descriptive entry in that page's history.

Configuration

flatpages_extra does not currently have any configurable options at the moment.

How it works

flatpages_extra works by creating a proxy model to Django's original FlatPage, which lets us change how the model works in the admin while keeping the same database table. It also adds a new Revision model that lets us preview, revert, and track changes to flat pages. Both of those models are registered in the admin and will replace the original contrib.flatpages admin pages.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_flatpages_extra-0.10.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_flatpages_extra-0.10.0-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file django_flatpages_extra-0.10.0.tar.gz.

File metadata

File hashes

Hashes for django_flatpages_extra-0.10.0.tar.gz
Algorithm Hash digest
SHA256 be5d886cbba71a7bd5afdc3de86c64ecddaf08ad3bafcc91052eea3b30bdf1a0
MD5 1ee392f15d427473450f91f0e66eeba0
BLAKE2b-256 28a20e7987431f771395de0881362971fa271dd3a0afc82b437e0e794cb9f49c

See more details on using hashes here.

File details

Details for the file django_flatpages_extra-0.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_flatpages_extra-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09a48825c79f8b4d0f02ec5b8f89ce2d7ca4efe302fc4e4f77d2302b1c803ff1
MD5 904bd5e722c8bd4be2da28f0504e737f
BLAKE2b-256 aec413f9dd2b0849d0c3aa0d00f0383c5d49a44bef3f7634b078d5322972479d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page