I am currently creating a query set of a Model.  I'm then iterating 
through the query set to create a calculation called "total". 
At the end of each loop I am adding "total" to the query set.  Example:-

qs= Cash.objects.all()
for i in qs:
   # calculate total
   i.total = total

Note:  The Cash object has no data field called "total".   I don't want 
to save this to the database because it is different for each user, so 
its created dynamically
for each view.

So far so good.  This works very well and allows me to iterate over the 
query set and the dynamically created attribute "total" in the template.

However,  I would now like to sort the qs using "total.".  Since there 
is no record in the DB I'm guessing that order_by will not work.   Can 
anybody advise on a way.

Thanks

MerMer

 

--~--~---------~--~----~------------~-------~--~----~
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