Skip to main content

Your project description goes here

Project description

https://badge.fury.io/py/django-activation-model-mixin.svg/?style=flat-square https://readthedocs.org/projects/pip/badge/?version=latest&style=flat-square Coverage Status

This package allows to quickly add an activation/deactivation logic to django models and associated admins. This means being able to mark an entry as active or inactive, saving the interaction time. Querysets, Managers and Signals are included.

Documentation

The full documentation is at https://django-activation-model-mixin.readthedocs.io.

Quickstart

Install Django Activation Model Mixin:

pip install django-activation-model-mixin

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'activation_model_mixin',
    ...
)

Features

  • ActivationModelMixin

  • ActivationModelMixinAdmin

  • ActivationQuerySet

  • Actions in admin changelist

  • Signals associated to activation action

Example of usage

# in your admin.py
from activation_model_mixin.admin import ActivationModelMixinAdmin
class ExampleModelAdmin(ActivationModelMixinAdmin, admin.ModelAdmin):
    ...

admin.site.register(ExampleModel, ExampleModelAdmin)

# in your models.py
from activation_model_mixin.models import ActivationModelMixin

class ExampleModel(ActivationModelMixin, models.Model):
    ...

Admin Interface

Here some users interface example.

First one is how the change form is shown. There is a new button in the submit row that allows to activate/deactivate one entry.

Not moderated instance image

This is how an accepted entry looks.

Accepted instance image

This is how a rejected entry looks.

Rejected instance image

Last image shows actions in the changelist.

Actions image

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Development commands

pip install -r requirements_dev.txt
invoke -l

Credits

Tools used in rendering this package:

History

0.1.0 (2021-11-15)

  • First release on PyPI.

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

django-activation-model-mixin-0.1.0.tar.gz (12.5 kB view hashes)

Uploaded Source

Built Distribution

django_activation_model_mixin-0.1.0-py2.py3-none-any.whl (10.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page