djangoproject.com icon indicating copy to clipboard operation
djangoproject.com copied to clipboard

Added flatpages-extra

Open bmispelon opened this issue 7 months ago • 7 comments

This PR adds django-flatpages-extra, which is a package I created after a discussion with @StephanieAG from the fundraising WG on how to make it easier to update flat pages.

As you can tell from the very short PR, the package is a drop-in replacement and is reversible. It adds the following features to the admin:

  • The ability to create a revision for a flat page
  • preview revisions (including a shareable link for people who don't have an admin account)
  • reverting revisions
  • better history of changes for flat pages

Initially I was going to develop this as an app in this project, but then realized it might be useful as a 3rd party too. If accepted I would release a 1.0 of the package.

Screenshots:

Editing content directly is disabled Screenshot 2025-08-02 at 12-02-50 _accessibility_ -- Django Accessibility Statement! Change flat page Django site admin
Preview page Screenshot 2025-08-02 at 12-07-34 Django Accessibility Statement! Django
Compare view (diff) Screenshot 2025-08-02 at 12-08-18 Comparing revision with original Django site admin

bmispelon avatar Aug 01 '25 23:08 bmispelon

Adding the link for easier review: https://pypi.org/project/django-flatpages-extra/

ulgens avatar Aug 07 '25 14:08 ulgens

+1 for having the "is published" feature and revisions, but not sure about offloading both of them to a new package.

  • If we are going to keep history, I'd prefer a package like https://django-simple-history.readthedocs.io/en/stable/ that works with every model.
  • For "is published" feature, I think a small custom model could solve it.

ulgens avatar Aug 07 '25 14:08 ulgens

@bmispelon I think we may want to have CI on that package as well, otherwise upgrades could be a bit tricky in the future [if things fall out of date with new versions of Django].

tim-schilling avatar Sep 18 '25 21:09 tim-schilling

@bmispelon I think we may want to have CI on that package as well, otherwise upgrades could be a bit tricky in the future [if things fall out of date with new versions of Django].

The code is hosted on Codeberg where CI is not so easy to set up. I've added a just ci command that runs the test suite (100% coverage) on all supported versions of Django: 5.0, 5.1, 5.2 and event 6.0 (alpha release). They all pass locally, so I've released the current code as version 1.0 on pypi.

I also took the liberty of rebasing this PR onto the latest main branch.

Would folks be ok if I deployed this on the preview server?

bmispelon avatar Oct 01 '25 18:10 bmispelon

+1 for having the "is published" feature and revisions, but not sure about offloading both of them to a new package.

* If we are going to keep history, I'd prefer a package like https://django-simple-history.readthedocs.io/en/stable/ that works with every model.

* For "is published" feature, I think a small custom model could solve it.

The "small custom model" is how django-flatpages-extra started. I originally created it inside the source code of this site, but realized it could be useful as a third party.

I've designed the django-flatpages-extra so it can be added and removed with no ill effect, so we can install it temporarily while an alternate solution is worked on (maybe one involving django-simple-history and/or a simpler custom model).

bmispelon avatar Oct 01 '25 18:10 bmispelon

The "small custom model" is how django-flatpages-extra started. I originally created it inside the source code of this site, but realized it could be useful as a third party.

Thanks for the details.

I've designed the django-flatpages-extra so it can be added and removed with no ill effect, so we can install it temporarily while an alternate solution is worked on (maybe one involving django-simple-history and/or a simpler custom model).

That sounds okay to me.

ulgens avatar Oct 02 '25 14:10 ulgens

I've deployed this to the preview server. I'll reach out to Stephanie to see if she has time to test it to see if it this solution would work for her.

bmispelon avatar Oct 02 '25 15:10 bmispelon