[Answer]-How to display many error django

1👍

You can’t reference a Many2ManyField like that, you have to use a method instead in the stores class that looks like this

def get_tags(): 
    return self.storeTags.all()

and reference that in your list_display(...'get_tags')

This is done because the M2M field would result in lots of SQL queries that would slow the entire thing down so therefore the choice would have to come from the developer and not from the framework.

0👍

Please check:

ModelAdmin.list_display

“ManyToManyField fields aren’t supported, because that would entail executing a separate SQL statement for each row in the table. If you want to do this nonetheless, give your model a custom method, and add that method’s name to list_display. (See below for more on custom methods in list_display.)”

You can use a custom method to show values of ManyToManyField or simply remove storeTags from list_display

Leave a comment