0

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?

user1406177
  • 1,198
  • 1
  • 17
  • 31
  • Can you please explain more what is your goal what are you trying to do? What do you have as input and what do you want as output etc. – DhiaTN Dec 14 '15 at 19:40
  • Basically, I want to rerender a part of my website wenn the button is clicked. I already know how to do that. But before doing that, I need to make this small example runnable. – user1406177 Dec 14 '15 at 20:33

1 Answers1

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.

Travis
  • 1,889
  • 1
  • 21
  • 34