Skip to content

Instantly share code, notes, and snippets.

@scottx611x
Last active August 10, 2017 19:50
Show Gist options
  • Save scottx611x/a4083540365eac6bf2e8d7bc151af677 to your computer and use it in GitHub Desktop.
Save scottx611x/a4083540365eac6bf2e8d7bc151af677 to your computer and use it in GitHub Desktop.
Class that exposes all of a models fields in the django admin interface
class AdminFieldPopulator(admin.ModelAdmin):
"""
Wrapper around ModelAdmin that exposes all of a Model's fields in admin ui
"""
def __init__(self, model, admin_site):
super(AdminFieldPopulator, self).__init__(model, admin_site)
self.list_display = [field.name for field in model._meta.fields]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment