mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Update filtersets.md
corrected typos on the page, an issue report has also been submitted at https://github.com/netbox-community/netbox/issues/10179 regards,
This commit is contained in:
parent
83db8d2072
commit
173f27cb64
@ -34,12 +34,12 @@ To utilize a filter set in a subclass of one of NetBox's generic views (such as
|
|||||||
```python
|
```python
|
||||||
# views.py
|
# views.py
|
||||||
from netbox.views.generic import ObjectListView
|
from netbox.views.generic import ObjectListView
|
||||||
from .filtersets import MyModelFitlerSet
|
from .filtersets import MyModelFilterSet
|
||||||
from .models import MyModel
|
from .models import MyModel
|
||||||
|
|
||||||
class MyModelListView(ObjectListView):
|
class MyModelListView(ObjectListView):
|
||||||
queryset = MyModel.objects.all()
|
queryset = MyModel.objects.all()
|
||||||
filterset = MyModelFitlerSet
|
filterset = MyModelFilterSet
|
||||||
```
|
```
|
||||||
|
|
||||||
To enable a filter set on a REST API endpoint, set the `filterset_class` attribute on the API view:
|
To enable a filter set on a REST API endpoint, set the `filterset_class` attribute on the API view:
|
||||||
|
Loading…
Reference in New Issue
Block a user