Commit d836256a by 周田

feat:(模拟)设备通信参数的增删查

parent b2d99fdd
...@@ -4,7 +4,12 @@ from . import views ...@@ -4,7 +4,12 @@ from . import views
urlpatterns = [ urlpatterns = [
re_path(r'^device_communication/$', views.get_protocol_names), re_path(r'^device_communication/$', views.get_protocol_names),
re_path(r'^device_communication/protocol_performance/$', views.get_protocol_field_names), re_path(r'^device_communication/protocol_performance/$', views.get_protocol_field_names),
re_path(r'^device_communication/set_communication_to_devinfo_table/$', views.set_communication_to_devinfo_table), re_path(r'^device_communication/set_communication_to_devinfo_table/$',
views.set_communication_to_devinfo_table),
re_path(r'^device_communication/communicate/$', re_path(r'^device_communication/communicate/$',
views.DeviceCommunicationParameterViewSet.as_view({'post': 'create'})), views.DeviceCommunicationParameterViewSet.as_view(
{'get': 'list', 'post': 'create', 'delete': 'destroy'})),
re_path(r'^device_communication/simulate_communicate/$',
views.SimulateDeviceCommunicationParameterViewSet.as_view(
{'get': 'list', 'post': 'create', 'delete': 'destroy'})),
] ]
\ No newline at end of file
...@@ -87,7 +87,17 @@ def set_communication_to_devinfo_table(request): ...@@ -87,7 +87,17 @@ def set_communication_to_devinfo_table(request):
class DeviceCommunicationParameterViewSet(mixins.CreateModelMixin, class DeviceCommunicationParameterViewSet(mixins.CreateModelMixin,
mixins.DestroyModelMixin,
mixins.ListModelMixin,
GenericViewSet): GenericViewSet):
queryset = DeviceCommunicationParameter.objects.all() queryset = DeviceCommunicationParameter.objects.all()
serializer_class = DeviceCommunicationParameterSerializer serializer_class = DeviceCommunicationParameterSerializer
class SimulateDeviceCommunicationParameterViewSet(mixins.CreateModelMixin,
mixins.DestroyModelMixin,
mixins.ListModelMixin,
GenericViewSet):
queryset = SimulateDeviceCommunicationParameter.objects.all()
serializer_class = SimulateDeviceCommunicationParameterSerializer
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment