blob: 7d962641857dfd6d9f05ac997a283465e0c7085f [file] [log] [blame]
Tony Macka7dbd422015-01-05 22:48:11 -05001
2def handle(site):
Tony Mack26564362015-01-06 17:49:25 -05003 from core.models import Controller, ControllerSite
Tony Macka7dbd422015-01-05 22:48:11 -05004 # make sure site has a ControllerSite record for each controller
5 ctrl_sites = ControllerSite.objects.filter(site=site)
6 existing_controllers = [cs.controller for cs in ctrl_sites]
7
8 all_controllers = Controller.objects.all()
9 for ctrl in all_controllers:
10 if ctrl not in existing_controllers:
11 ctrl_site = ControllerSite(controller=ctrl, site=site)
12 ctrl_site.save()