Last active
August 10, 2017 19:50
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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