{"id":13532206,"url":"https://github.com/Frojd/wagtail-trash","last_synced_at":"2025-04-01T20:31:33.972Z","repository":{"id":44641826,"uuid":"305655038","full_name":"Frojd/wagtail-trash","owner":"Frojd","description":"Instead of deleting pages when pressing delete, pages will get thrown into the \"Trash Can\".","archived":false,"fork":false,"pushed_at":"2025-02-01T07:25:56.000Z","size":106,"stargazers_count":38,"open_issues_count":6,"forks_count":7,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-02-01T08:22:54.308Z","etag":null,"topics":["recycle","trash","trashcan","wagtail"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Frojd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-20T09:22:24.000Z","updated_at":"2024-09-06T22:31:26.000Z","dependencies_parsed_at":"2023-02-10T18:00:29.288Z","dependency_job_id":"62012280-fde2-4a12-ab1b-180bb1a871ce","html_url":"https://github.com/Frojd/wagtail-trash","commit_stats":{"total_commits":129,"total_committers":6,"mean_commits":21.5,"dds":"0.49612403100775193","last_synced_commit":"4322f0735f9ffa7d506d60f1e381c1e79973425d"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frojd%2Fwagtail-trash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frojd%2Fwagtail-trash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frojd%2Fwagtail-trash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frojd%2Fwagtail-trash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Frojd","download_url":"https://codeload.github.com/Frojd/wagtail-trash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709923,"owners_count":20821297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["recycle","trash","trashcan","wagtail"],"created_at":"2024-08-01T07:01:09.061Z","updated_at":"2025-04-01T20:31:28.958Z","avatar_url":"https://github.com/Frojd.png","language":"Python","funding_links":[],"categories":["Apps"],"sub_categories":["Misc"],"readme":"[![Run tests, lint and publish](https://github.com/Frojd/wagtail-trash/actions/workflows/main.yml/badge.svg)](https://github.com/Frojd/wagtail-trash/actions/workflows/main.yml) [![PyPI version](https://badge.fury.io/py/wagtail-trash.svg)](https://badge.fury.io/py/wagtail-trash)\n\n# wagtail trash\n\nInstead of deleting pages when pressing delete, pages will get thrown into the \"Trash Can\".\n\n\n## Install\n\n1. First install the python package:\n`pip install wagtail-trash`\n\nThis step will install both `wagtail-trash` and `wagtail-modeladmin` which is a requirement for the admin.\n\n2. Then add both `wagtail-trash` and `wagtail-modeladmin` to your `INSTALLED_APPS`:\n\n```python\nINSTALLED_APPS = [\n    # ...\n    \"wagtail_modeladmin\",\n    \"wagtail_trash\",\n]\n```\n\n3. Run migrations, et voila!\n\n\n## How it works\n\nWagtail Trash works by hooking into the Wagtail hook `before_delete_page` and overriding the delete view.\nInstead of deleting the page the page gets moved to the special \"Trash\" page. The deleted page and all descendants will get unpublished.\nFrom the trash can in Wagtail admin it's then possible to permanently delete the page or to restore the page. Restoring a page will also republish the pages that were published when getting deleted.\nIf the parent of the deleted page is either in the trash can or permanently deleted it's still possible to restore the pages by supplying an alternate parent.\n\n\n## Caveats\n\nSince Wagtail Trash uses the hook `before_delete_page` it might interfere with your applications `before_delete_page` if you have defined one that returns a status code. Make sure wagtail trash is the last hook that runs otherwise or your custom `before_delete_page` might not run since Wagtail Trash doesn't call it.\n\nAlso, Wagtail Trash \"deletes\" pages by unpublishing them, so if you use a queryset that doesn't filter out unpublished pages, pages in trash can might show up. There is a manager that will fix this for you included, example:\n\n```python\nfrom wagtail.core.models import Page, PageManager\nfrom wagtail_trash.managers import TrashManager\n\nclass SomePage(Page):\n    objects = PageManager()  # needed, so _default_manager isn't the trash manager\n    objects_excluding_trash = TrashManager()\n\n# Now you can do this without getting any pages from the bin:\nSomePage.objects_excluding_trash.all()\n```\n\nPermissions: If you remove a page under a restricted area, this page will be moved and therefore get new permissions. A user might go from not being allowed to see pages under e.g. \"Secret Page\", but when a page under this area is moved to trash can, the permissions from \"Secret Page\" are gone so now the user will see it in the trash can.\nThis is a solvable issue and will be fixed in a later version.\n\n\n## Clearing the bin regularly\n\nThere is an included managment-command called `empty_trash` that takes a required argument `--older_than_days`. To remove all items in the bin that's been there more than 30 days run this command:\n\n`./manage.py empty_trash --older_than_days=30`\n\n## Git flow\n\nThis project uses git flow, current release is in the `main` branch and the current development is in the `develop` branch.\n\n\n## License\n\nwagtail trash is released under the [MIT License](http://www.opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrojd%2Fwagtail-trash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFrojd%2Fwagtail-trash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrojd%2Fwagtail-trash/lists"}