﻿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
16257	contrib:admin dynamic list_display_links support	graveyboat	nobody	"Ticket #14206 created a very useful way to allow programmers to override list_display at runtime by using a new function get_list_display instead of accessing self.list_display.  Unfortunately, it potentially causes an issue with list_display_links. 

If list_display_links is not set in the ModelAdmin instance, currently the first field after 'action_checkbox' in list_display becomes list_display_links.  Since get_list_display happens after list_display_links is set, there is a potential that what is returned from get_list_display no longer contains the field in list_display_links.  Take the following for example:

{{{
class DynamicListDisplayChildAdmin(admin.ModelAdmin):
    list_display = ('name', 'parent')

    def get_list_display(self, request):
        my_list_display = list(self.list_display)
        if request.user.username == 'noparents':
            my_list_display.remove('name')

        return my_list_display
}}}

In this case, list_display_links would be ['name'], but 'name' is no longer in the list_display passed to the ChangeList instance.  Basically, the fix is to create a get_list_display_links method that is capable of checking list_display if necessary."	New feature	closed	contrib.admin	1.3	Normal	fixed	list_display override dynamic admin		Accepted	1	0	0	1	0	0
