Skip to content

Using controlled vocabularies in the admin list_filter  #18

@majdal

Description

@majdal

Hello!

I'm still using this package extensively in a project. For one of my models, I have a ControlledTermField, and I would like to filter against it in the admin using list_filter.

Current behaviour: If I add my ControlledTermField in my list_filter, all the controlled terms from all the vocabularies are listed in the filter, not just the ones from that specific field.

Desired behaviour: only the terms that belong to the vocabulary of the specified field should be displayed.

According to the Django docs, we can set a SimpleListFilter, and that works perfectly fine. I'm wondering two things:

  1. If there is a way to abstract the SimpleListFilter and include it in the package
  2. If abstraction would be too cumbersome/unnecessary, perhaps include a snippet in the docs to guide future users of the package.

Thanks again for the great work on the package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions