diff --git a/.gitignore b/.gitignore index 3f04b96..a1c554f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *__pycache__* -db.sqlite3 \ No newline at end of file +db.sqlite3 +bookshelf_management/apps/mgmt/migrations/* \ No newline at end of file diff --git a/bookshelf_management/apps/mgmt/static/booklist.js b/bookshelf_management/apps/mgmt/static/booklist.js index 2104298..b36fccd 100644 --- a/bookshelf_management/apps/mgmt/static/booklist.js +++ b/bookshelf_management/apps/mgmt/static/booklist.js @@ -30,4 +30,10 @@ } + if(urlParams.has('addTitle')){ + // console.log(urlParams.get('addId')) + $('#add-title').val(urlParams.get('addTitle')) + + } + })(jQuery) \ No newline at end of file diff --git a/bookshelf_management/apps/mgmt/templates/bookshelf.html b/bookshelf_management/apps/mgmt/templates/bookshelf.html index c516ba6..6759f21 100644 --- a/bookshelf_management/apps/mgmt/templates/bookshelf.html +++ b/bookshelf_management/apps/mgmt/templates/bookshelf.html @@ -8,6 +8,7 @@ Number of Books in Bookshelf:

{{ total }}

{% if user.is_authenticated %} +

{% csrf_token %} {{ form }} diff --git a/bookshelf_management/apps/mgmt/templates/searchToAdd.html b/bookshelf_management/apps/mgmt/templates/searchToAdd.html index 21d511f..58159f3 100644 --- a/bookshelf_management/apps/mgmt/templates/searchToAdd.html +++ b/bookshelf_management/apps/mgmt/templates/searchToAdd.html @@ -16,7 +16,7 @@ diff --git a/bookshelf_management/apps/mgmt/views.py b/bookshelf_management/apps/mgmt/views.py index ae717f6..e7a88ba 100644 --- a/bookshelf_management/apps/mgmt/views.py +++ b/bookshelf_management/apps/mgmt/views.py @@ -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')