We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Right now we need to use EnumFieldListFilter like this:
from enumfields.admin import EnumFieldListFilter class MyModelAdmin(admin.ModelAdmin): list_filter = [('color', EnumFieldListFilter)]
It's easy to forget it (see #75 ).
But there is a better way. By using django's FieldListFilter.register we can "attach" the filter to the EnumField:
FieldListFilter.register
from django.contrib.admin.filters import FieldListFilter from .fields import EnumFieldMixin class EnumFieldListFilter(ChoicesFieldListFilter): .... FieldListFilter.register(lambda f: isinstance(f, EnumFieldMixin), EnumFieldListFilter)
This should work with both EnumField and EnumIntegerField fields. The EnumFieldListFilter section in the README won't be needed anymore.
This should work for django > 1.4. For older versions there is a workaround.
Would you be interested in a pull request? These days I try to ask beforehand.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Right now we need to use EnumFieldListFilter like this:
It's easy to forget it (see #75 ).
But there is a better way. By using django's
FieldListFilter.register
we can "attach" the filter to the EnumField:This should work with both EnumField and EnumIntegerField fields. The EnumFieldListFilter section in the README won't be needed anymore.
This should work for django > 1.4. For older versions there is a workaround.
Would you be interested in a pull request? These days I try to ask beforehand.
The text was updated successfully, but these errors were encountered: