A Django app to make recyclebin.
Project description
===== Django Recyclebin
Django Recyclebin is a Django app to create recyclebin functionality in your project. you will be able to temporarily delete, restore and permanently delete data.
Detailed documentation is in the "docs" directory.
Quick start
-
Add "recyclebin" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [ ... 'polls', ]
-
import SoftDeleteMixin ''from recyclebin.models import SoftDeleteMixin''
-
Inherit your model with SoftDeleteMixin
class Mymodel(SoftDeleteMixin): ''model fields''
-
Run
python manage.py makemigrations
andpython manage.py migrate
. -
import recyclebin functions ''from recyclebin.functions import get_deleted_items, restore, permanent_delete''
-
How to temporarily delete. you don't need to do anything. after inheriting your model with SoftDeleteMixin. your regular .delete() method will temporarily delete objects
-
How to view deleted items create a list of models from myapp.models import Model1, Model2, Model3... li = [Model1, Model2, Model3...] get_deleted_items(li)
''This function will return serialized response that will contain model_name, name, pk, deleted_by, deleted_at''
YOUR MODEL MUST HAVE NAME FIELD OTHERWISE NONE WILL BE RETURNED INSTEAD OF NAME
-
How to restore pass restore function model name and id. model name must be string and id an integer restore(model1, 1)
-
How to permanently delete pass permanent_delete function model name and id. model name must be string and id an integer permanent_delete(model1, 1)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_recyclebin-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b4461d821edc12fa8b8c3a9d9a55bbb757d8b70bfda70cd6c1ae4525602c880 |
|
MD5 | 86eae7f738cb6de94d5cd660ee5e8b5d |
|
BLAKE2b-256 | 594340159d0982848f485781e0fe3888baab7acd8dc99f4971f55458ac09a8e1 |