Mark
Mark

Reputation: 83

Exclude duplicates from django admin page

My question is the following: can you exclude objects that are duplicated from being displayed on the admin page without DB modification, and if yes, how?

Thanks for all the help in advance

Upvotes: 1

Views: 131

Answers (1)

Danil
Danil

Reputation: 5181

You can overwrite queryset inside your Admin model

def queryset(self, request):
    qs = super(MyModelAdmin, self).queryset(request)
    # update your query somehow
    return qs.distinct()

Upvotes: 1

Related Questions