diff --git a/src/interface/static/js/pyshelf_ux.js b/src/interface/static/js/pyshelf_ux.js index 5095e05..604057f 100755 --- a/src/interface/static/js/pyshelf_ux.js +++ b/src/interface/static/js/pyshelf_ux.js @@ -74,8 +74,8 @@ $(document).ready(function(){ $('#btn_login').on('click', function(){ $('#hdr_nav_login').toggle(); }); - $('.favorite_action').on('click', toggle_favorite(){ - + $('.favorite_action').on('click', function(){ + $(this).toggleClass('favorite'); }); $('#sortlist').change(function () { var optionSelected = $(this).find("option:selected"); @@ -105,7 +105,3 @@ function resize_search(win_width){ } } -function toggle_favorite($(this)){ - custom_log('Favorite book by _pk'+$(this)); -} - diff --git a/src/interface/views.py b/src/interface/views.py index 4a79b0d..60e14e2 100755 --- a/src/interface/views.py +++ b/src/interface/views.py @@ -233,11 +233,11 @@ def favorite(request, pk): _d = Favorites.objects.filter(user=request.user, book=Books.objects.get(pk=pk)) if len(_d) == 1: _d.delete() - return redirect('home') + return HttpResponse(status=204) _f = Favorites(book=Books.objects.get(pk=pk)) _f.user = request.user _f.save() - return redirect('home') + return HttpResponse(status=204) def share(request, pk):