1414from openwisp_users .api .filters import OrganizationManagedFilter
1515from openwisp_users .api .mixins import FilterByOrganizationManaged , FilterByParentManaged
1616
17- from ...mixins import ProtectedAPIMixin , RelatedDeviceProtectedAPIMixin
17+ from ...mixins import (
18+ AutoRevisionMixin ,
19+ ProtectedAPIMixin ,
20+ RelatedDeviceProtectedAPIMixin ,
21+ )
1822from .filters import DeviceListFilter
1923from .serializers import (
2024 DeviceCoordinatesSerializer ,
@@ -57,7 +61,9 @@ class ListViewPagination(pagination.PageNumberPagination):
5761 max_page_size = 100
5862
5963
60- class DeviceCoordinatesView (ProtectedAPIMixin , generics .RetrieveUpdateAPIView ):
64+ class DeviceCoordinatesView (
65+ ProtectedAPIMixin , AutoRevisionMixin , generics .RetrieveUpdateAPIView
66+ ):
6167 serializer_class = DeviceCoordinatesSerializer
6268 permission_classes = (DevicePermission ,)
6369 queryset = Device .objects .select_related (
@@ -105,6 +111,7 @@ def create_location(self, device):
105111
106112class DeviceLocationView (
107113 RelatedDeviceProtectedAPIMixin ,
114+ AutoRevisionMixin ,
108115 FilterByParentManaged ,
109116 generics .RetrieveUpdateDestroyAPIView ,
110117):
@@ -203,7 +210,9 @@ def get_queryset(self):
203210 return qs
204211
205212
206- class FloorPlanListCreateView (ProtectedAPIMixin , generics .ListCreateAPIView ):
213+ class FloorPlanListCreateView (
214+ ProtectedAPIMixin , AutoRevisionMixin , generics .ListCreateAPIView
215+ ):
207216 serializer_class = FloorPlanSerializer
208217 queryset = FloorPlan .objects .select_related ().order_by ("-created" )
209218 pagination_class = ListViewPagination
@@ -213,13 +222,16 @@ class FloorPlanListCreateView(ProtectedAPIMixin, generics.ListCreateAPIView):
213222
214223class FloorPlanDetailView (
215224 ProtectedAPIMixin ,
225+ AutoRevisionMixin ,
216226 generics .RetrieveUpdateDestroyAPIView ,
217227):
218228 serializer_class = FloorPlanSerializer
219229 queryset = FloorPlan .objects .select_related ()
220230
221231
222- class LocationListCreateView (ProtectedAPIMixin , generics .ListCreateAPIView ):
232+ class LocationListCreateView (
233+ ProtectedAPIMixin , AutoRevisionMixin , generics .ListCreateAPIView
234+ ):
223235 serializer_class = LocationSerializer
224236 queryset = Location .objects .order_by ("-created" )
225237 pagination_class = ListViewPagination
@@ -229,6 +241,7 @@ class LocationListCreateView(ProtectedAPIMixin, generics.ListCreateAPIView):
229241
230242class LocationDetailView (
231243 ProtectedAPIMixin ,
244+ AutoRevisionMixin ,
232245 generics .RetrieveUpdateDestroyAPIView ,
233246):
234247 serializer_class = LocationSerializer
0 commit comments