django-nonrel / djangotoolbox

Django tools for building nonrel backends

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

order refactor breaks QuerySet.reverse()

aburgel opened this issue · comments

commit bd292d6 excludes self.query.standard_ordering which handles reverse(). here's a test case. i'm going to work on a fix.

def test_reverse(self):
        class DBColumn(models.Model):
            a = models.IntegerField(db_column='b')
        model1 = DBColumn.objects.create(a=1)
        model2 = DBColumn.objects.create(a=2)
        self.assertEqual(list(DBColumn.objects.all().order_by('a').reverse()), [model2, model1])
        self.assertEqual(list(DBColumn.objects.all().order_by('-a').reverse()), [model1, model2])

That's right, even a simpler test, without the db_column, fails.