summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1971784)
Must still correct current counts on the server after deployment.
book = get_object_or_404(models.Book, slug=book)
shelf = get_object_or_404(models.Tag, slug=shelf, category='set', user=request.user)
book = get_object_or_404(models.Book, slug=book)
shelf = get_object_or_404(models.Tag, slug=shelf, category='set', user=request.user)
- models.Tag.objects.remove_tag(book, shelf)
-
- shelf.book_count -= 1
- shelf.save()
-
- return HttpResponse('Usunieto')
+ if shelf in book.tags:
+ models.Tag.objects.remove_tag(book, shelf)
+
+ shelf.book_count -= 1
+ shelf.save()
+
+ return HttpResponse('Usunięto')
+ else:
+ return HttpResponse('Książki nie ma na półce')
def collect_books(books):
def collect_books(books):