You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
At present the admin autocomplete docs mention `ModelAdmin.autocomplete_fields` and `ModelAdmin.search_fields` which are used to configure select2. There are also options for overriding the queryset used.
However there seems to be no way of specifyng what is shown in the autocomplete... it just calls `__str__` on the objects returned.
Would it be possible to add a `search_display_fields` on the relevant ModelAdmin, alongside `search_fields` to customise the display in the form select box? This could be either a model field or a callable on the model or modeladmin.
Cheers!
bjw
Janez Kranjc
unread,
Aug 8, 2019, 5:10:49 PM8/8/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
I have also come across the need for this and would be willing to work on a pull request for this feature.
1337 Shadow Hacker
unread,
Aug 11, 2019, 9:54:03 AM8/11/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-d...@googlegroups.com
Would it be possible to add a `search_display_fields` on the relevant ModelAdmin, alongside `search_fields` to customise the display in the form select box? This could be either a model field or a callable on the model or modeladmin.
Another suggestion is to add get_FIELD_autocomplete_display(), to the model or teh ModelAdmin
Janez Kranjc
unread,
Aug 11, 2019, 6:25:01 PM8/11/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
You don't need one for each field. You need one per model - similar to __str__
bjw
unread,
Aug 11, 2019, 7:06:41 PM8/11/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
Actually, I can think of occasions where what is displayed would vary depending on which model the FK was from, not only on the model that is the target.