diff --git a/dashboard/templates/unassigned_devices.html b/dashboard/templates/unassigned_devices.html
index d697e78..bc1365f 100644
--- a/dashboard/templates/unassigned_devices.html
+++ b/dashboard/templates/unassigned_devices.html
@@ -50,7 +50,7 @@
{% endfor %}
-
+
{% endblock %}
diff --git a/lot/forms.py b/lot/forms.py
index 119192c..0065960 100644
--- a/lot/forms.py
+++ b/lot/forms.py
@@ -15,8 +15,13 @@ class LotsForm(forms.Form):
def save(self, commit=True):
if not commit:
return
- # import pdb; pdb.set_trace()
for dev in self.devices:
for lot in self._lots:
lot.devices.add(dev.id)
return
+
+ def remove(self):
+ for dev in self.devices:
+ for lot in self._lots:
+ lot.devices.remove(dev.id)
+ return
diff --git a/lot/urls.py b/lot/urls.py
index 0a641d4..4f3af01 100644
--- a/lot/urls.py
+++ b/lot/urls.py
@@ -7,4 +7,5 @@ urlpatterns = [
path("add/", views.NewLotView.as_view(), name="add"),
path("edit//", views.EditLotView.as_view(), name="edit"),
path("add/devices/", views.AddToLotView.as_view(), name="add_devices"),
+ path("del/devices/", views.DelToLotView.as_view(), name="del_devices"),
]
diff --git a/lot/views.py b/lot/views.py
index d570883..50a95a8 100644
--- a/lot/views.py
+++ b/lot/views.py
@@ -87,3 +87,14 @@ class AddToLotView(DashboardView, FormView):
return response
+class DelToLotView(AddToLotView):
+ title = _("Remove from lots")
+ breadcrumb = "lot / remove from lots"
+
+ def form_valid(self, form):
+ form.devices = self.get_session_devices()
+ form.remove()
+ response = super().form_valid(form)
+ return response
+
+