[Answered ]-Filter urlencode with 2 Level reverse relationship

1๐Ÿ‘

โœ…

if you want to filter Investment by the issuer_id you can simply change the list_filter in ModelAdmin like this

@admin.register(Investment)
class Investment_Register(admin.ModelAdmin):
    list_filter = ["offering__issuer__id"]

and then pass the id of issuer to URL like this
http://localhost:8000/app/investment/?offering__issuer__id={id-issuer}

note: if you give an error like this

(admin.E116) The value of 'list_filter[0]' refers to 'offering__issuer__id', which does not refer to a Field.

add field id minimally to your model

๐Ÿ‘คNova

Leave a comment