review feedback
parent
3232e96b71
commit
1150b985a3
|
@ -1,2 +1,3 @@
|
|||
*__pycache__*
|
||||
db.sqlite3
|
||||
db.sqlite3
|
||||
bookshelf_management/apps/mgmt/migrations/*
|
|
@ -30,4 +30,10 @@
|
|||
|
||||
}
|
||||
|
||||
if(urlParams.has('addTitle')){
|
||||
// console.log(urlParams.get('addId'))
|
||||
$('#add-title').val(urlParams.get('addTitle'))
|
||||
|
||||
}
|
||||
|
||||
})(jQuery)
|
|
@ -8,6 +8,7 @@
|
|||
<strong class="heading-info">Number of Books in Bookshelf:</strong> <p>{{ total }}</p>
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
<p id="add-title"></p>
|
||||
<form class="add-form" action="/bookshelves/{{bookshelfId}}" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<ul>
|
||||
{% for book in books %}
|
||||
<li class="bookshelf" id="book-{{ book.id }}">
|
||||
<a href="/bookshelves/{{bookshelfId}}?addId={{ book.id }}">{{ book.title }}</a>
|
||||
<a href="/bookshelves/{{bookshelfId}}?addId={{ book.id }}&addTitle={{ book.title }}">{{ book.title }}</a> <p> [ <a href="https://www.gutenberg.org/ebooks/{{ book.id }}">click here to view on gutenberg site</a> ]</p>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
@ -27,7 +27,7 @@ def insertBookToBookshelf(bookId, bookshelfId):
|
|||
def booksInBookshelf(request, bookshelfId):
|
||||
bookshelfName = Bookshelf.objects.get(id=bookshelfId).bookshelf
|
||||
idList = BookshelfToBook.objects.filter(fk_bookshelves=bookshelfId).values_list('fk_books', flat=True)
|
||||
books = Book.objects.filter(id__in=idList)
|
||||
books = Book.objects.filter(id__in=idList).order_by('bookshelf')
|
||||
|
||||
context = {
|
||||
'books': books,
|
||||
|
@ -125,7 +125,7 @@ def searchBooks(request):
|
|||
|
||||
|
||||
def getBooksMatchingTitle(term):
|
||||
return Book.objects.filter(title__contains=term).order_by('title')
|
||||
return Book.objects.filter(title__icontains=term).order_by('title')
|
||||
|
||||
def bookshelfList(request):
|
||||
bookshelves = Bookshelf.objects.all().order_by('bookshelf')
|
||||
|
|
Loading…
Reference in New Issue