Scott Baker | af599eb | 2017-03-21 12:43:26 -0700 | [diff] [blame] | 1 | from synchronizers.new_base.modelaccessor import * |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 2 | |
| 3 | def handle(site): |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 4 | # site = Site.get(site_id) |
| 5 | # make sure site has a ControllerSite record for each controller |
Scott Baker | af599eb | 2017-03-21 12:43:26 -0700 | [diff] [blame] | 6 | ctrl_sites = ControllerSite.objects.filter(site_id=site.id) |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 7 | 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() |