Fraskito
Fraskito

Reputation: 109

Filter list_filter in django admin

I need to filter by a field one to many but I just want to show related objects and not all.

is this possible, or I have to create a custom filter?

Upvotes: 3

Views: 628

Answers (1)

Mike Ritchie
Mike Ritchie

Reputation: 11

I try to keep my templates as "dumb" as possible, so I would definitely filter my data in the view. You could try something like this:

filtered_results = [ row for row in results if row['key'] == 'value' ]

Upvotes: 1

Related Questions