﻿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
11163	admin ForeignKeyRawIdWidget contains incorrect link when used in change list view	margieroginski@…	nobody	"When the user specifies in their admin.py that a field is both editable and a raw_id, like this:

    list_editable = ('owner',)
    raw_id_fields = ('owner',)

the ForeignKeyRawIdWidget is used in the change list view for that field.  However, the code in the ForeignKeyRawIdWidget's render() method is hardcoded to be called from the edit form, with the following code: 

        related_url = '../../../%s/%s/' % (self.rel.to._meta.app_label, self.rel.to._meta.object_name.lower())

When called from the change list, the url has one less entry than when called from the edit form.  As a result, the link is wrong when called from the change list.  For example, the url for the changelist is something like this:

   http://mysite.com/admin/taskmanager/task/

while the url from the edit form is like this:

   http://mysite.com/admin/taskmanager/task/1

So when used in the change list, the raw id widget's link ends up pointing to http://mysite.com/auth/user/?t=id rather than http://mysite.com/admin/auth/user/?t=id

"		new	Uncategorized	1.0					Unreviewed	0	0	0	0	0	0
