Ejemplo n.º 1
0
 def form_valid(self, form):
     queue = form.save(commit=False)
     if is_queueing_possible(queue.book_copy, queue.borrower):
         messages.add_message(
             self.request,
             messages.ERROR,
             _("You are already waiting for this book. Delete your previous demand before doing a new one!"),
         )
     else:
         queue.save()
         messages.add_message(
             self.request, messages.SUCCESS, _("You have been successfully added to the queue for this book!")
         )
     return redirect("book_detail", book_id=queue.book_copy.book.id)
Ejemplo n.º 2
0
def can_queue(book_copy, user):
    return not is_queueing_possible(book_copy,user)