blob: 23010a2e1b3cd4302f5670e248fea3c0433a9c1a [file] [log] [blame]
Tony Macka7dbd422015-01-05 22:48:11 -05001
2def handle(site):
Sapan Bhatia085ed482015-01-17 00:56:36 +00003 from core.models import Controller, ControllerSite, Site
4
5 # site = Site.get(site_id)
Tony Macka7dbd422015-01-05 22:48:11 -05006 # make sure site has a ControllerSite record for each controller
7 ctrl_sites = ControllerSite.objects.filter(site=site)
8 existing_controllers = [cs.controller for cs in ctrl_sites]
9
10 all_controllers = Controller.objects.all()
11 for ctrl in all_controllers:
12 if ctrl not in existing_controllers:
13 ctrl_site = ControllerSite(controller=ctrl, site=site)
14 ctrl_site.save()