blob: 7d962641857dfd6d9f05ac997a283465e0c7085f [file] [log] [blame]
def handle(site):
from core.models import Controller, ControllerSite
# make sure site has a ControllerSite record for each controller
ctrl_sites = ControllerSite.objects.filter(site=site)
existing_controllers = [cs.controller for cs in ctrl_sites]
all_controllers = Controller.objects.all()
for ctrl in all_controllers:
if ctrl not in existing_controllers:
ctrl_site = ControllerSite(controller=ctrl, site=site)
ctrl_site.save()