Skip to content

Instantly share code, notes, and snippets.

NotSqrt /
Last active May 1, 2022 01:34 — forked from nealtodd/
Another shot at this problem ..
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return "notmigrations"
MIGRATION_MODULES = DisableMigrations()
NotSqrt / list_display
Created July 6, 2013 16:07
default populating of list_display with all the fields
View list_display
class CommonAdmin(admin.ModelAdmin):
ordering = ['id']
def __init__(self, *args, **kwargs):
super(CommonAdmin, self).__init__(*args, **kwargs)
self.set_list_display(args[0]) # set fields to display --> all of them
def set_list_display(self, model):
fields = []
for field in model._meta.fields: