On Jun 26, 11:35 am, pihentagy <pihent...@gmail.com> wrote:
> 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?

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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to