blob: f800092fcd9ca5766459eb99824309995bbb3224 [file] [log] [blame]
Scott Bakeraf599eb2017-03-21 12:43:26 -07001from synchronizers.new_base.modelaccessor import *
Scott Bakerb63ea792016-08-11 10:24:48 -07002
3def handle(site):
Scott Bakerb63ea792016-08-11 10:24:48 -07004 # site = Site.get(site_id)
5 # make sure site has a ControllerSite record for each controller
Scott Bakeraf599eb2017-03-21 12:43:26 -07006 ctrl_sites = ControllerSite.objects.filter(site_id=site.id)
Scott Bakerb63ea792016-08-11 10:24:48 -07007 existing_controllers = [cs.controller for cs in ctrl_sites]
8
9 all_controllers = Controller.objects.all()
10 for ctrl in all_controllers:
11 if ctrl not in existing_controllers:
12 ctrl_site = ControllerSite(controller=ctrl, site=site)
13 ctrl_site.save()