review feedback

adam
aundus 2021-05-07 12:48:59 -04:00
parent 3232e96b71
commit 1150b985a3
5 changed files with 12 additions and 4 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
*__pycache__*
db.sqlite3
db.sqlite3
bookshelf_management/apps/mgmt/migrations/*

View File

@ -30,4 +30,10 @@
}
if(urlParams.has('addTitle')){
// console.log(urlParams.get('addId'))
$('#add-title').val(urlParams.get('addTitle'))
}
})(jQuery)

View File

@ -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 }}

View File

@ -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>

View File

@ -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')