[Answer]-Order object_list with django-profiles

1👍

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

👤Steven

Leave a comment