mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Toggle favorite without losing postion in catalog
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user