Basic approval support for models

Easymode comes with easypublisher, a very simple approval application. It uses django-reversion to store drafted content. This has the very nice side effect that all drafts are in your history.

There is only one layer of approval, either you’ve got publishing rights or you don’t. Anyone with publisher rights can move content from draft to published, as long as they’ve got permission to modify the content.

To use the publisher you have to include easymode.easypublisher in your INSTALLED_APPS. After that, you may use EasyPublisher instead of ModelAdmin as follows:

from django.contrib import admin
from foobar.models import *
from easymode.easypublisher.admin import EasyPublisher

class FooAdmin(EasyPublisher):
    model = Foo

admin.site.register(Foo, FooAdmin)

A new permission will be added easypublisher.can_approve_for_publication if some body does NOT have this permission, all their changes will only be saved as versions and never in the database. All people who DO have this permission can view the list of drafts, load them and save them, which means they are published. All your drafts and versions will be kept track of by django-reversion.

In case you want to use easypublisher together with easymode.tree.admin.relation you will find that multiple inheritance doesn’t work due to conflicts. Instead, use easymode.easypublisher.admin.EasyPublisherFKAModelAdmin where you would use ForeignKeyAwareModelAdmin and easymode.easypublisher.admin.EasyPublisherInvisibleModelAdmin where you would use InvisibleModelAdmin.

More info about these admin classes is in Admin support for model trees with more than 2 levels of related items.

Easypublisher templatetag draft_list_items()

draft_list_items() is a templatetag that can be used to show all drafts that need approval as a list of links to these drafts. You could include it in your admin template somewhere.

use like this:

{% load 'easypublisher' %}

<ul>
{% draft_list_items %}
</ul>

This will render as a list of links to all unapproved drafts.

Project Versions

Table Of Contents

Previous topic

Admin support for model trees with more than 2 levels of related items

Next topic

Easymode settings

This Page