diff --git a/apps/assets/api/node.py b/apps/assets/api/node.py
index d7499760a..f123e4649 100644
--- a/apps/assets/api/node.py
+++ b/apps/assets/api/node.py
@@ -32,6 +32,7 @@ __all__ = [
'NodeViewSet', 'NodeChildrenApi',
'NodeAssetsApi', 'NodeWithAssetsApi',
'NodeAddAssetsApi', 'NodeRemoveAssetsApi',
+ 'NodeReplaceAssetsApi',
'NodeAddChildrenApi', 'RefreshNodeHardwareInfoApi',
'TestNodeConnectiveApi'
]
@@ -191,6 +192,19 @@ class NodeRemoveAssetsApi(generics.UpdateAPIView):
instance.assets.remove(*tuple(assets))
+class NodeReplaceAssetsApi(generics.UpdateAPIView):
+ serializer_class = serializers.NodeAssetsSerializer
+ queryset = Node.objects.all()
+ permission_classes = (IsSuperUser,)
+ instance = None
+
+ def perform_update(self, serializer):
+ assets = serializer.validated_data.get('assets')
+ instance = self.get_object()
+ for asset in assets:
+ asset.nodes.set([instance])
+
+
class RefreshNodeHardwareInfoApi(APIView):
permission_classes = (IsSuperUser,)
model = Node
diff --git a/apps/assets/templates/assets/_add_assets_to_node_modal.html b/apps/assets/templates/assets/_add_assets_to_node_modal.html
new file mode 100644
index 000000000..31641e722
--- /dev/null
+++ b/apps/assets/templates/assets/_add_assets_to_node_modal.html
@@ -0,0 +1,7 @@
+{% extends 'assets/_asset_list_modal.html' %}
+{% load i18n %}
+
+{% block modal_button %}
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/apps/assets/templates/assets/_asset_list_modal.html b/apps/assets/templates/assets/_asset_list_modal.html
index b68ab0378..a4f2c7f77 100644
--- a/apps/assets/templates/assets/_asset_list_modal.html
+++ b/apps/assets/templates/assets/_asset_list_modal.html
@@ -1,132 +1,126 @@
{% extends '_modal.html' %}
{% load i18n %}
+{% load static %}
{% block modal_class %}modal-lg{% endblock %}
{% block modal_id %}asset_list_modal{% endblock %}
-{#{% block modal_title%}{% trans "Please select assets" %}{% endblock %}#}
+{% block modal_title%}{% trans "Asset list" %}{% endblock %}
{% block modal_body %}
-{#
#}
-{# #}
-{# #}
-{#
#}
-
-