Source

Ochs / courses / admin.py

from django.contrib import admin
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.admin.views.decorators import staff_member_required

from staff import util
from staff.models import FACULTY
from courses.models import Course
from ochs_admin import admin_site

class CoursesAdmin(admin.ModelAdmin):
    model = Course

    def has_add_permission(self, request):
        return util.check_role(request.user, FACULTY)

    def has_change_permission(self, request, obj=None):
        return util.check_role(request.user, FACULTY)
    has_delete_permission = has_change_permission
admin_site.site.register(Course, CoursesAdmin)

def roster(request):
    context = dict()
    return render_to_response(
        "admin/books/report.html",
        context,
        RequestContext(request, {}),
    )
report = staff_member_required(roster)