﻿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
9994	list_filter ignores to_field	Jason Zylks	Malcolm Tredinnick	"When using the to_field option in a foreign key field, and then filtering on that field in the admin interface, the filter attempts to match the primary key with the values taken from the to_field.

For Example:

{{{

class Department(models.Model):
	code = models.CharField(max_length=4, unique=True)
	description = models.CharField(max_length=50, blank=True, null=True)

class Employee(models.Model):
	department = models.ForeignKey(Department, to_field=""code"")
	name = models.CharField(max_length=100)

...

class EmployeeAdmin(admin.ModelAdmin):
	list_display = ['name', 'department']
	list_filter = ['department']

...

}}}

Suppose there is a department, 'FINC' with id 1; the filter that is generated is {{{department__id__exact=FINC}}} rather than {{{department__code__exact=FINC}}} or {{{department__id__exact=1}}}.
"	Uncategorized	closed	contrib.admin	1.0	Normal	fixed			Accepted	0	0	0	0	0	0
