admin.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:heltour 作者: cyanfish 项目源码 文件源码
def create_slack_channels(self, request, queryset):
        team_ids = []
        skipped = 0
        for team in queryset.select_related('season').nocache():
            if not team.season.is_active or team.season.is_completed:
                self.message_user(request, 'The team season must be active and not completed in order to create channels.', messages.ERROR)
                return
            if len(team.season.tag) > 3:
                self.message_user(request, 'The team season tag is too long to create a channel.', messages.ERROR)
                return
            if team.slack_channel == '':
                team_ids.append(team.pk)
            else:
                skipped += 1
        signals.do_create_team_channel.send(sender=self, team_ids=team_ids)
        self.message_user(request, 'Creating %d channels. %d skipped.' % (len(team_ids), skipped), messages.INFO)

#-------------------------------------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号