1

How to display url to objects from Many To Many relation instead standard widget?

For example url's to Author objects here:

enter image description here

2 Answers2

0

I think one way is to overwrite str method of Author.

Another is to change widget for that field Django: Admin: changing the widget of the field in Admin , my prefered method.

Community
  • 1
  • 1
aisbaa
  • 9,867
  • 6
  • 33
  • 48
0

Django admin offers to properties that change the way m2m fields act in the admin: filter_vertical and filter_horizontal use them like this:

class MyModelAdmin(admin.ModelAdmin):
    filter_horizontal = ('author',)

or replace with filter_vertical use one or the other on the same field.

Bogdan Iulian Bursuc
  • 2,215
  • 1
  • 16
  • 19