blob: 8d1424484a779d26a2f3cdc0d4eb21b0624c5ba4 [file] [log] [blame]
Sapan Bhatia3b182032014-09-03 15:38:56 -04001def handle(user):
Sapan Bhatia485490d2015-01-17 00:56:36 +00002 from core.models import Controller, ControllerSite, ControllerUser, User
Tony Mack74364932015-01-06 17:49:25 -05003 from collections import defaultdict
Sapan Bhatia485490d2015-01-17 00:56:36 +00004
5 # user = User.get(user_id)
Tony Mack74364932015-01-06 17:49:25 -05006
7 controller_users = ControllerUser.objects.filter(user=user)
8 existing_controllers = [cu.controller for cu in controller_users]
9 all_controllers = Controller.objects.all()
10 for controller in all_controllers:
11 if controller not in existing_controllers:
12 ctrl_user = ControllerUser(controller=controller, user=user)
13 ctrl_user.save()
Sapan Bhatia3b182032014-09-03 15:38:56 -040014