link add search pg
parent
616d118440
commit
214c37a8f0
|
@ -21,4 +21,13 @@
|
|||
}
|
||||
})
|
||||
|
||||
const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
|
||||
if(urlParams.has('addId')){
|
||||
// console.log(urlParams.get('addId'))
|
||||
$('#id_bookid').val(urlParams.get('addId'))
|
||||
|
||||
}
|
||||
|
||||
})(jQuery)
|
|
@ -11,7 +11,7 @@
|
|||
<form class="add-form" action="/bookshelves/{{bookshelfId}}" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<input type="submit" value="Add Book">
|
||||
<input type="submit" id="add-book-btn" value="Add Book">
|
||||
</form>
|
||||
<p class="form-help">Or search for a book to add <a href="/bookshelves/{{bookshelfId}}/search">here</a></p>
|
||||
{% endif %}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<ul>
|
||||
{% for book in books %}
|
||||
<li class="bookshelf" id="book-{{ book.id }}">
|
||||
<a href="https://www.gutenberg.org/ebooks/{{ book.id }}">{{ book.title }}</a>
|
||||
<a href="/bookshelves/{{bookshelfId}}?addId={{ book.id }}">{{ book.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
@ -86,7 +86,7 @@ def searchBooksToAdd(request, bookshelfId):
|
|||
context['form'] = BookSearchForm()
|
||||
|
||||
# redirect to a new URL:
|
||||
return render(request, 'search.html', context=context)
|
||||
return render(request, 'searchToAdd.html', context=context)
|
||||
|
||||
# if a GET (or any other method) we'll create a blank form
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue