Order object_list with django-profiles

Using the django-profiles app, I want to display the users' profiles in an ordered list. Ordered by different fields, depending on the situation.

Now the docs say something about passing extra arguments to the views here but I don't know how to do that, since the urls are just included (as opposed by defined by myself).

So,how can I pass in the "order_by" part that I can just use in the normal list view?

Answers


Checking the code [1], there is no way to alter the queryset in the way you want.

Your best option is probably to write this view yourself, using the existing implementation as a guide if you like (e.g. you can still call object_list when you've got a queryset ordered to your specification). Then either override the profile list URL in your own urls.py by declaring it first:

...
url(r'^profiles/$', path.to.my_profile_list_view, name='my_profile_list'), 

(r'^profiles/', include('profiles.urls')),
...

or create a new URL for this and use that on your site instead:

url(r'^ordered-profiles/$', path.to.my_profile_list_view, name='my_profile_list'),

[1] https://bitbucket.org/ubernostrum/django-profiles/src/c21962558420/profiles/views.py#cl-287

See also: https://bitbucket.org/ubernostrum/django-profiles/src/c21962558420/profiles/urls.py


Need Your Help

Java Repaints only every other guess

java swing repaint paintcomponent

I have a function that prints how many guesses there are for a player.

Publish Jekyll Site To Git Repository

git jekyll

Every time I run Jekyll it destroys the entire contents of the destination folder. The problem with this is that my destination directory is a small git repo from which I use to push to my actual

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.