﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
5057	Ordering by a foreign key which has a descending ordering fails	Robert Myers <myer0052@…>	Adrian Holovaty	"If you have two models like this:

{{{
class MyYear(models.Model):
    year = models.PositiveIntegerField()

    class Meta:
        ordering = ('-year',)

class OtherYear(models.Model):
    year = models.ForeignKey(MyYear)
    other_field = models.CharField(maxlength=100)
    
    class Meta:
        ordering = ('year')
    
    class Admin:
        list_display = ('year', 'other_field')
}}}

The Admin page for the second model gives a 500 error something along the lines:
{{{
ERROR: column app_myyear.-year does not exist SELECT
}}}

It appears the get_query_set method in the ChangeList class just blindly combines the table_name and its _meta.ordering together giving you 'table.-field' "		closed	contrib.admin	dev		duplicate			Unreviewed	1	0	0	0	0	0
