-
Notifications
You must be signed in to change notification settings - Fork 188
Description
Django: 2.1.7
Admin sortable2: 0.7
I have a special admin page where I do not want anything to be a link to the item because users sorting the content are not necessarily allowed to edit the items that can be sorted.
So, as per the Django docs, I set my settings like this:
model = WhoIsWhoFunction
list_display = ['on_whoiswho', 'functionname', ]
list_display_links = None
list_editable = ['on_whoiswho']
sortable_by = [] # Disable sorting on all columns since adminsortable2 will take care of that
And then, to my surprise I get the following error:
<class 'pe.admin.WhoIsWhoFunctionAdmin'>: (admin.E123) The value of 'on_whoiswho' cannot be in both 'list_editable' and 'list_display_links'.
This is caused by the code here:
if not self.list_display_links:
self.list_display_links = (self.list_display[0],)
This code was there from the beginning, but why? If a developer thinks list_display_links should be empty, why do you fill it? Except for removing the default order field from that list, it does not seem to be used for anything, so why is it set?
Commenting these lines out solves my problem and does not seem to have a negative effect.
(Changing the order of my list_display fields so a different field than 'on_whoiswho' gets added to list_display_links also removes the error, but that gives me an unwanted link.)