I have a basic many to many relationship of:
Song to Playlist with PlaylistMember as the through model
Now I am displaying the songs in the playlist detail view using an inline View that is a subclass of TabularInline:
class PlaylistMemberInline(TabularInline):
model = PlaylistMember
raw_id_fields = ('Sound',)
class PlaylistAdmin(TranslatableAdmin):
...
inlines = [PlaylistMemberInline]
To add multiple sounds I have to click on "Add another Sound", and then find that sound on a popup. This is annoying in my case, as I can find all sounds I want to add, but then have to click one and go back to "Add another Sound".
Is there a widget where I can search for, select and then add multiple Objects?
Django source code (1.8 branch here, line 254) suggests that you can add your ForeignKey to radio_fields or raw_id_fields, resulting in a different widget.
In this case, add the field name "Sound" to PlaylistMemberInline.raw_id_fields
,
consider adding it to PlaylistMemberInline.radio_fields
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With