blob: 23010a2e1b3cd4302f5670e248fea3c0433a9c1a [file] [log] [blame]
Scott Bakerb63ea792016-08-11 10:24:48 -07001
2def handle(site):
3 from core.models import Controller, ControllerSite, Site
4
5 # site = Site.get(site_id)
6 # 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()