Skip to main content

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


Download files

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

Source Distribution

wagtail_neuralyzer-0.2.5.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

wagtail_neuralyzer-0.2.5-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file wagtail_neuralyzer-0.2.5.tar.gz.

File metadata

  • Download URL: wagtail_neuralyzer-0.2.5.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wagtail_neuralyzer-0.2.5.tar.gz
Algorithm Hash digest
SHA256 0e70ad84d5b86ab75571ba1273b26e4d2728b1122d396a02dd34aef422de5fb7
MD5 92d4332daf41c24976788b925e168244
BLAKE2b-256 095ef0654c3df3db19495d9c6c6faab54fc566d681d09146ae9b2d90d6659598

See more details on using hashes here.

File details

Details for the file wagtail_neuralyzer-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_neuralyzer-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0fc500b319bc2154ed0ba56bc40f95dc57a52d9d7ab666a0a35b862f21deaf30
MD5 900c6002fc85e929977e8c6ff05462a1
BLAKE2b-256 601c8be5f9d28d2671891e08ec4689e30a3b963c4296a2fc64f919d2bb0042ea

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