Anonymize specific django model for specific instance - support for wagtail
Project description
wagtail-neuralyzer
Pairs with django-neuralyzer, with wagtail support.
Install
pip install wagtail-neuralyzer
Register a model to have neuralyze action
Add wagtail_neuralyzer to your INSTALLED_APP:
INSTALLED_APP = [
...
"django_neuralyzer",
"wagtail_neuralyzer",
...
]
Add item action
Add the NeuralyzeSnippetViewSetMixin to your snippet class:
from wagtail_neuralyzer.views import NeuralyzeSnippetViewSetMixin
from wagtail_neuralyzer.views import NeuralyzeView
from my_app.neuralyzers import PersonNeuralyzer
# Create a new view that handle url and action as well as neuralyzer class
class OperatorNeuralyzeView(NeuralyzeView):
neuralyzer_class = OperatorNeuralyzer
# inherit NeuralyzeSnippetViewSetMixin to register new url and neuralyze view
class PersonSnippetViewSet(NeuralyzeSnippetViewSetMixin, SnippetViewSet):
model = Person
neuralyze_view_class = OperatorNeuralyzeView
...
and finally register the new action:
from wagtail import hooks
from wagtail_neuralyzer.menu_item import NeuralyzeMenuItem
@hooks.register("register_snippet_action_menu_item")
def register_anonymize_menu_item(model):
if model == Person:
return NeuralyzeMenuItem()
And Tada, your model should have an "Anonymize" action together with save/delete/publish/...
Add bulk action
You can also add bulk action to the index view by registering wagtail hook
from wagtail import hooks
from wagtail_neuralyzer.action import NeuralyzeBulkAction
from my_app.models import Person
from my_app.neuralyzers import StudentNeuralyzer
@hooks.register("register_bulk_action")
class PersonNeuralyzerBulkAction(NeuralyzeBulkAction):
models = [Person] # specify model here
neuralyzer_class = PersonNeuralyzer # and neuralyzer to use here
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wagtail_neuralyzer-0.2.1.tar.gz.
File metadata
- Download URL: wagtail_neuralyzer-0.2.1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ca97fe45e8cebf487360286e7ae9abffb97bbd32cb5629005c5dabdffc0458a
|
|
| MD5 |
fb0d9843ebe5265344c5d080a9e3f29e
|
|
| BLAKE2b-256 |
ad1fba1a0b2e7dcac89e0d4819f97b8cf028c1b6d766db55b43c6b8e59f22ab0
|
File details
Details for the file wagtail_neuralyzer-0.2.1-py3-none-any.whl.
File metadata
- Download URL: wagtail_neuralyzer-0.2.1-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4960013ad51d41465fafa5674683564c7887c04db6224cb40672bf027c9508aa
|
|
| MD5 |
36670e8f1f19af383f3f3cdbc576a2bf
|
|
| BLAKE2b-256 |
a7a4d17b0db4ef47b69e8a79ed6ad45b8705f5e7416490a21a2734489b92e797
|