1👍
✅
There’s not an easy way to include a property like nse_markt_typ
in the search_fields
list.
Would it be possible to change your model to add a foreign key to MDfile
? Then you can use the double underscore __
to search a field on the linked object.
class Scrip_Master(models.Model):
nse_markt_typ = models.ForeignKey(MDfile, blank=True, null=True)
class Scrip_MasterAdmin(admin.ModelAdmin):
...
search_fields = ['nse_markt_typ__mkt_type', ...]
Note that you cannot use nse_markt_typ__mkt_type
in list_display
, so you might have to create a property, or use nse_markt_typ
and set a suitable __unicode__
for your MDfile
model.
Source:stackexchange.com