Skip to content

Instantly share code, notes, and snippets.

View fstnando's full-sized avatar

Sergio Fernando Sanz Troiani fstnando

View GitHub Profile
@nicpottier
nicpottier / view_permission.py
Created March 22, 2011 07:43
Adds a view permission to all your models in Django
from django.db.models.signals import post_syncdb
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission
def add_view_permissions(sender, **kwargs):
"""
This syncdb hooks takes care of adding a view permission too all our
content types.
"""
# for each of our content types