Index filters visible in ModelViewSet history view
seb-b opened this issue · comments
Issue Summary
The index filters are visible in a ModelViewSet's history. It might be in other mixin views, this was just the one I noticed. They don't do anything when clicked except update the url
Steps to Reproduce
# models.py
from wagtail.models import RevisionMixin
class Product(RevisionMixin):
name = models.CharField(max_length=255)
in_stock = models.BooleanField()
panels = [
FieldPanel('name'),
FieldPanel('in_stock')
]
# wagtail_hooks.py
from wagtail.admin.viewsets.model import ModelViewSet
from .models import Product
class ProductViewSet(ModelViewSet):
model = Product
list_filter = ('in_stock',)
# register viewset via the hook
- I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: no
Technical details
- Python version: 3.11
- Django version: 4.2
- Wagtail version: 6.0.1
Thanks for the report, but I wasn't able to replicate this with a fresh Wagtail project and the given model and the following viewset registered:
from wagtail import hooks
from wagtail.admin.viewsets.model import ModelViewSet
from .models import Product
class ProductViewSet(ModelViewSet):
model = Product
list_filter = ("in_stock",)
add_to_admin_menu = True
icon = "pick"
# register viewset via the hook
@hooks.register("register_admin_viewset")
def register_product_viewset():
return ProductViewSet("products")
The history view shows the filters for the log actions and can be used to filter the listing:
If you encounter this issue, perhaps check whether you pass the viewset's list_filter
to the history view, e.g. via get_history_view_kwargs
, get_common_view_kwargs
, or the history_view
property. Passing a list_filter
to the HistoryView could give you unexpected behaviour.
ah my mistake, I didn't realise these filters were for filtering the history view and got a bit mixed up. I'll close this