2

我有以下 jQuery 代码可以从我的 Django 应用程序中发送推文。它按原样完美运行,但是有没有办法知道我当前的用户是否发了推文?我想在用户发推文时将布尔属性设置为 true。关于如何做到这一点的任何想法?

!function(d,s,id,emp){
    var js,fjs=d.getElementsByTagName(s)[0];
    if(!d.getElementById(id)){
        js=d.createElement(s);
        js.id=id;
        js.src="//platform.twitter.com/widgets.js";
        fjs.parentNode.insertBefore(js,fjs);
        }}(document,"script","twitter-wjs");
4

1 回答 1

1

Since Javascript is runs in browser an Django is running on server side, I think you will have to make a request to your server that will tell Django the current user has tweeted, this means you will have to create a view that will handle that request.

于 2012-07-13T17:15:10.540 回答