dajaxice: something went wrong

為{幸葍}努か 提交于 2019-12-12 03:17:28

问题


I have a ul list and a button:

<form>{% csrf_token %}
    <div class="list-arrows col-md-1 text-center">
        <button class="btn btn-default btn-sm move-left">
            <span class="glyphicon glyphicon-chevron-left"></span>
        </button>
    </div>
</form>

This triggers my ajax request:

function publListChanged()
{
    var publs = $('.list-right ul li.active');
    Dajaxice.awv_public.reload_stats(Dajax.process, {'publs': '10'})
}


$(function () {

    [...]
    $('.list-arrows button').click(function () {
        var $button = $(this), actives = '';
        if ($button.hasClass('move-left')) {
            publListChanged();
        }
    }
}

Currently, for debugging, my method does nothing:

@dajaxice_register
def reload_stats(request, publs):
    dajax = Dajax()
    return dajax.json()

I get the following error: Dajaxice: Something went wrong. I have no idea where to look. What should I do?


回答1:


I suspect what went wrong is that you're using the latest version of Django.

Djaxice is a dead project and stopped working after Django 1.6 was released, although the exact version when it broke doesn't appear to be documented. (This inference in this Github issue was the closest I could find to documenting exactly which version broke.)

I once tried upgrading Django in an existing project and found that it broke Djaxice. (This was a while back, so I don't remember what exactly the error was.)

Quoting from the official Github repo: "Should I use django-dajaxice? In a word, No."

Several people have tried to port Djaxice to newer versions of Django, but I've never seen a successful fork. (Maybe a new one was created since I last looked.) I've looked into porting it myself, but found it to be non-trivial.



来源:https://stackoverflow.com/questions/34274753/dajaxice-something-went-wrong

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!