blob: b7b16ad3d4b0140af1026d2c3baa0b2dafae33da [file] [log] [blame]
Sapan Bhatia3b182032014-09-03 15:38:56 -04001def handle(user):
Tony Mack74364932015-01-06 17:49:25 -05002 from core.models import Controller, ControllerSite, ControllerUser
3 from collections import defaultdict
4
5 controller_users = ControllerUser.objects.filter(user=user)
6 existing_controllers = [cu.controller for cu in controller_users]
7 all_controllers = Controller.objects.all()
8 for controller in all_controllers:
9 if controller not in existing_controllers:
10 ctrl_user = ControllerUser(controller=controller, user=user)
11 ctrl_user.save()
Sapan Bhatia3b182032014-09-03 15:38:56 -040012