Esempio n. 1
0
 def _sync_team(self, team):
     team_dict = self.client.teams.find_by_id(team['gid'])
     logger.debug(team_dict)
     if self.commit:
         remote_id = team_dict['gid']
         organization = team_dict.pop('organization')
         team_dict['organization_id'] = organization['gid']
         team_dict['organization_name'] = organization['name']
         pop_unsupported_fields(team_dict, Team)
         Team.objects.get_or_create(remote_id=remote_id, defaults=team_dict)
Esempio n. 2
0
 def _sync_tag(self, tag, workspace):
     tag_dict = self.client.tags.find_by_id(tag["gid"])
     logger.debug(tag_dict)
     if self.commit:
         remote_id = tag_dict["gid"]
         tag_dict["workspace"] = workspace
         followers_dict = tag_dict.pop("followers")
         pop_unsupported_fields(tag_dict, Tag)
         tag = Tag.objects.get_or_create(remote_id=remote_id, defaults=tag_dict)[0]
         follower_ids = [follower["gid"] for follower in followers_dict]
         followers = User.objects.filter(id__in=follower_ids)
         tag.followers.set(followers)