mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00: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:
@ -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:
|
||||||
|
Reference in New Issue
Block a user