Skip to content

Instantly share code, notes, and snippets.

@aweakley
aweakley / admin.py
Created Jun 6, 2019
Example readonly admin class for Django
View admin.py
# -*- coding: utf-8 -*-
from django.contrib import admin
class ReadonlyAdmin(admin.ModelAdmin):
"""
Example admin class which makes all fields readonly
"""
def __init__(self, model, admin_site):
super(ReadonlyAdmin, self).__init__(model, admin_site)