Hi Guys
I have a database that stores unit numbers in postgresql
eg 3B , 2, 5 , 4C, 1 etc.. so it had to be string type for the letters
but now i want to order them in ascending order on the template eg.
1, 2, 3b etc..
The problem is in my view function
def summary(request):
unit_list = Unit.objects.all().order_by('unit')
// the order by unit "the database field" is not ordering properly
because of the letters and it been a string
its coming out like this 2, 3b, 1 ....
the model below:
class Unit(models.Model):
unit = models.CharField(maxlength=32)
Any ideas?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---