forms.py 文件源码

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

项目:slack-announcement-approval 作者: trianglefraternitymtu 项目源码 文件源码
def __init__(self, *args, **kwargs):
        super(TeamSettingsForm, self).__init__(*args, **kwargs)

        slack = Slacker(kwargs['instance'].access_token)

        priv_ch = [(g['id'], g['name']) for g in slack.groups.list().body['groups'] if not (g['is_archived'] or g['name'].startswith('mpdm'))]
        pub_ch = [(c['id'], c['name']) for c in slack.channels.list().body['channels'] if not c['is_archived']]
        users = [(u['id'], u['profile']['real_name']) for u in slack.users.list().body['members'] if not u['deleted']]

        self.fields['post_channel'].widget = forms.Select(choices=tuple(pub_ch))
        self.fields['approval_channel'].widget = forms.Select(choices=tuple(pub_ch + priv_ch + users))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号