Search Results

Search found 1 results on 1 pages for 'snz3'.

Page 1/1 | 1 

  • Using django and django-voting app, how can I order a queryset according to the votes of each item?

    - by snz3
    (I'm new to python and django so please bear with me for a second. I apologise if this has been answered elsewhere and couldn't find it) Let's say I have a Link model and through the django-voting application users can vote on link instances. How can I order those link instances according to their score, eg. display those with the higher score first. I assume I could use the get_top manager of django-voting, but that would only give me the top scoring link instances and wouldn't take into consideration other parameters I would like to add (for example, those links that belong to a specific user or paging or whatever). My guess would be to write a custom manager for my Link model where by I can filter a queryset according to each item's score. If I understand correctly that will require me to loop through each item, check its score, and then place it a list (or dictionary) which will then be sorted according to the score of each item. That wouldn't return a queryset but a dictionary with each item. Am I missing something here?

    Read the article

1