Added new model policies for images and controllerslices
diff --git a/planetstack/model_policies/model_policy_Image.py b/planetstack/model_policies/model_policy_Image.py
new file mode 100644
index 0000000..72f76fa
--- /dev/null
+++ b/planetstack/model_policies/model_policy_Image.py
@@ -0,0 +1,13 @@
+def handle(image):
+ from core.models import Controller, ControllerImages, Image
+ from collections import defaultdict
+
+ controller_images = ControllerImages.objects.filter(image=image)
+ existing_controllers = [cs.controller for cs in controller_images]
+
+ all_controllers = Controller.objects.all()
+ for controller in all_controllers:
+ if controller not in existing_controllers:
+ sd = ControllerImages(image=image, controller=controller)
+ sd.save()
+