Rob Slotboom wrote:
> Because I cant handle my prefered sorting in a query, I need to sort
> the result afterward.
> I could define some other functions in the custom manager to handle all
> and filter
> But this isn't a solution:
> 
> allcats = Cat.sorted_objects.all()
> allcats.filter(var='val') <<
> 
> Isn't there a way to grap the result from the QS, sort it and place it
> back?

Not since the sorting is done in Python instead of SQL. If you were using
order_by it would work how you want. (If your Category URLs all have the
same prefix, I would just sort by whatever field is being put in the URL
since that's probably the only difference). But since you are sorting in
Python in this case the QuerySet must be resolved into a list -- there's no
way to tell the SQL in the QuerySet to rearrange them in an arbitrary order
as far as I know (I'm not sure how that could work).

But if get_absolute_url() just returns 'http://whatever/categories/' +
self.name for example, it may make sense to just do
Category.objects.order_by('name').filter(...).

-- 
Brian Beck
Adventurer of the First Order


--~--~---------~--~----~------------~-------~--~----~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to