def _require_permission(code, name, content_type):
 from django.contrib.auth.models import Permission
 criteria = {'codename': code, 'name': name, 'content_type': content_type}
 permission = Permission.objects.get_or_create(**criteria)[0]
 return permission

def _require_permission ( code , name , content_type ) : from django . contrib . auth . models import Permission criteria = { 'codename' : code , 'name' : name , 'content_type' : content_type } permission = Permission . objects . get_or_create ( ** criteria ) [ 0 ] return permission
helper to get/create a new permission .