Building locally in SQLite. My app has numbers for prices of object. In SQLite I was able to sort prices regulary (ex: $914, $799, $120, $95, 9.00, 7.50.)
After pushing the app to Postgres the numbers come up as such: 95, 914, 9.00, 799, 7.50, 120.
I'm obviously looking to order them by price high to low and low to high in Postgres. What am I doing wrong?
Model Field:
price = models.DecimalField(max_digits=8, decimal_places=2, null=True)
URL:
url(r'^browse/price_desc/$', 'collection.views.price_desc', name="pricehigh")
View:
def price_desc(request):
items = item.objects.all.order_by('-price')
return render(request, 'index.html', {
'items' : items,
})
Aucun commentaire:
Enregistrer un commentaire