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 | |
Scott Baker | af599eb | 2017-03-21 12:43:26 -0700 | [diff] [blame] | 3 | def handle(user): |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 4 | # user = User.get(user_id) |
| 5 | |
| 6 | controller_users = ControllerUser.objects.filter(user=user) |
| 7 | existing_controllers = [cu.controller for cu in controller_users] |
| 8 | all_controllers = Controller.objects.all() |
| 9 | for controller in all_controllers: |
| 10 | if controller not in existing_controllers: |
| 11 | ctrl_user = ControllerUser(controller=controller, user=user) |
| 12 | ctrl_user.save() |
| 13 | |