django-sharing

Django row level object sharing app
Download

django-sharing Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Publisher Name:
  • Praekelt Foundation
  • Publisher web site:
  • http://praekelt.com

django-sharing Tags


django-sharing Description

Django row level object sharing app django-sharing is a Django row level sharing app limiting content access by user in Django admin.Installation 1. Install or add django-sharing to your python path. 2. Add 'sharing' to the project's INSTALLED_APPS setting. 3. Add 'sharing.backends.SharingBackend' to the project's AUTHENTICATION_BACKENDS setting.UsageIn order for django-sharing to limit content access your various admin classes need to include the ShareAdminMixin class. For example:# admin.pyfrom django.contrib import adminfrom sharing.admin import ShareAdminMixinclass ArticleAdmin(ShareAdminMixin, admin.ModelAdmin): passadmin.site.register(Article, ArticleAdmin)It is crucial for ShareAdminMixin to be the first ancestor class in the admin class' definition.Alternatively you can automatically enable sharing for all models registered with the admin site. django-sharing includes an admin_mixin_share method which will apply the ShareAdminMixin class to all models registered with the admin site. Call the method after admin.autodiscover() in urls.py:# urls.pyfrom django.conf.urls.defaults import *from django.contrib import adminimport sharingadmin.autodiscover()sharing.admin_mixin_share()urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)),)Once the ShareAdminMixin class has been applied your admin change views should include Group and User share inlines and restrict content appropriately.


django-sharing Related Software