def destroy_oauth(request,site): """ 删除一个绑定 """ unlogined_redirect(request) ts=TokenService(request.user) ts.deleteToken(site) return redirect("account:oauth_manage")
def oauth_manage_view(request): """ 用户的第三方平台账号管理页面 """ unlogined_redirect(request) from accounts.platform.config import site_config import copy sitelist = copy.deepcopy(site_config) ts = TokenService(request.user) for site in sitelist: for token in ts.getTokens(): if token.site == site['site']: site['token'] = token return render(request,'accounts/oauth_manage.html',{'sitelist':sitelist})