django-gatekeeper

Django object moderation
Download

django-gatekeeper Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Jeremy Carbaugh

django-gatekeeper Tags


django-gatekeeper Description

Django object moderation django-gatekeeper is a Django application for moderation of model instances.Provides convenience methods and an admin interface for moderating instances of registered Django models.Installation:To install run python setup.py installwhich will install the application into python's site-packages directory.Quick Setupsettings.pyAdd to INSTALLED_APPS: gatekeeperBe sure to place gatekeeper above any application which contains models that will be moderated.Add to MIDDLEWARE_CLASSES: gatekeeper.middleware.GatekeeperMiddlewareRegister Models >>> from django.db import models >>> import gatekeeper >>> class MyModel(models.Model): ... pass >>> gatekeeper.register(MyModel)Admin Moderation QueueInclude the following in urls.py BEFORE the default admin: url(r'^admin/gatekeeper/', include('gatekeeper.urls')),Filtering Moderated Models >>> from myapp.models import MyModel >>> import gatekeeper >>> def index(request): ... my_models = gatekeeper.approved(MyModel.objects.get(creator=request.user))Advanced UsageAuto-ModerationIt can be hassle to have to manually moderate objects when there is a simple ruleset used to determine how an object will be moderated. In order to use auto-moderation, the following needs to be added to settings.py: GATEKEEPER_ENABLE_AUTOMODERATION = TrueGatekeeper provides two methods of auto-moderation. First, if the user that saves a moderated object has permission to moderate that object, it will be automatically approved. This will always happen if GATEKEEPER_ENABLE_AUTOMODERATION is set to true in settings.py. The second form of auto-moderation allows a moderation method to be written. This method should return True to approve, False to reject, or None to pass on for manual moderation. The auto-moderation function is pass as an argument when registering a Model. >>> class MyModel(models.Model): ... pass >>> def myautomod(obj): ... pass >>> gatekeeper.register(MyModel, auto_moderator=myautomod)If the auto-moderation function returns None or is not specified for a model, the first form of auto-moderation will be attempted.Default ModerationBy default, moderated model instances will be marked as pending and placed on the moderation queue when created. This behavior can be overridden by specifying GATEKEEPER_DEFAULT_STATUS in settings.py. * 0 - mark objects as pending and place on the moderation queue * 1 - mark objects as approved and bypass the moderation queue * -1 - mark objects as rejected and bypass the moderation queueModeration Queue NotificationsGatekeep will send a notification email to a list of recipients when a new object is placed on the moderation queue. Specify GATEKEEPER_MODERATOR_LIST in settings.py to enable notifications. GATEKEEPER_MODERATOR_LIST = Post-moderation SignalMany applications will want to execute certain tasks once an object is moderated. Gatekeeper provides a signal that is fired when an object is manually or automatically moderated. gatekeeper.post_moderation Requirements: · Python · Django


django-gatekeeper Related Software