admin like list view

3 views
Skip to first unread message

pihentagy

unread,
Jun 26, 2009, 11:35:13 AM6/26/09
to Django users
Hi!

I am developing a django app, which will be installed at multiple
places with different configuration.

It has some models, and list views.

I store in a config dict the fields/methods to be displayed, and I'd
like to offer sorting (automagically for all fields, where possible).
My big problem is that I cannot verify, wheter for eg.:
'item__price_display' is a valid argument to sort by. The only way is
to create a filter query, and force executing it (by getting the first
element for eg.), but that would add much extra queries and seems
unconvenient.

So basically I'd like to have a generic list view with configurable
columns AND automagic sorting links on columns where possible (without
extra db queries)

Is it possible?

thanks
Gergo

Rajesh D

unread,
Jun 26, 2009, 12:04:45 PM6/26/09
to Django users
You can introspect the Model class to see that the displayed field is
a valid model field and turn on your sort option if it is a model
field. You said it all in your subject line: you want an admin like
list view. The best place to start is to look into how the admin does
it.

-RD
Reply all
Reply to author
Forward
0 new messages