mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Fix incorrect import in rest-api.md
This commit is contained in:
parent
d39acfd3f2
commit
e216bebd41
@ -84,11 +84,11 @@ To create a viewset for a plugin model, subclass `NetBoxModelViewSet` in `api/vi
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
# api/views.py
|
# api/views.py
|
||||||
from netbox.api.viewsets import ModelViewSet
|
from netbox.api.viewsets import NetBoxModelViewSet
|
||||||
from my_plugin.models import MyModel
|
from my_plugin.models import MyModel
|
||||||
from .serializers import MyModelSerializer
|
from .serializers import MyModelSerializer
|
||||||
|
|
||||||
class MyModelViewSet(ModelViewSet):
|
class MyModelViewSet(NetBoxModelViewSet):
|
||||||
queryset = MyModel.objects.all()
|
queryset = MyModel.objects.all()
|
||||||
serializer_class = MyModelSerializer
|
serializer_class = MyModelSerializer
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user