Question

I'd like to get the values in class variables like list_display and list_filter from a view. Something like:

def some_view():
    print Order.list_display 
    ...
Was it helpful?

Solution

So you want access to associated ModelAdmin objects from the model instance? How about this:

from django.contrib import admin
print admin.site._registry[Order].list_display
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top