Any reason not to make the total 0 instead of None? Null in database (or None in Python) has a special meaning, and it doesn't always make sense to sort a list of (mostly) integers with some null values.
-Jeff On Jun 30, 2:01 am, J <jobce...@gmail.com> wrote: > Hello, > > I developed an app for an online contest. > > In this app, I requested a queryset with totals from a related table, > and wanted to display the top ten participants. So, I sorted the > queryset on the totals field, descending. Some participants didn't have > any items, so the total for these was "None". > > When using sqlite, this appeared as I wanted, with the objects having > "None" at the bottom, and thus not included in the top ten. > > However, after uploading this app to the production site, which has a > postgres db, the None participants appeared at the top of the list (!), > and THEN came the largest items successively decreasing as expected. My > top-ten program failed. > > Any ideas? > > Thanks, > J > > PS: Examples: > > Developement, sqlite, working: > AR003 147 > CH005 69 > CO001 50 > CO031 50 > CH029 49 > AR004 None > AR029 None > > Production, postgres, not working: > CO217 None > CO024 3000 > PE017 1400 > VE025 988 > CO013 930 > PE203 628 > CH016 523 --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---