diff --git a/CalibreWebCompanion/db.sqlite3 b/CalibreWebCompanion/db.sqlite3
index d5c379a..67f7a65 100644
Binary files a/CalibreWebCompanion/db.sqlite3 and b/CalibreWebCompanion/db.sqlite3 differ
diff --git a/CalibreWebCompanion/library/__pycache__/forms.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/forms.cpython-38.pyc
index a27ce3b..81af47a 100644
Binary files a/CalibreWebCompanion/library/__pycache__/forms.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/forms.cpython-38.pyc differ
diff --git a/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc
index 9625490..8b6e950 100644
Binary files a/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc differ
diff --git a/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc
index f897e15..d6d40ff 100644
Binary files a/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc differ
diff --git a/CalibreWebCompanion/library/forms.py b/CalibreWebCompanion/library/forms.py
index 319166a..7a28e4c 100644
--- a/CalibreWebCompanion/library/forms.py
+++ b/CalibreWebCompanion/library/forms.py
@@ -6,7 +6,7 @@ from django.contrib.auth.models import User
class SearchForm(forms.Form):
title = forms.CharField(label="Title", max_length=200)
author = forms.CharField(label='Author', max_length=100)
- # identifier = forms.CharField(label='Identifier(ISBN, Google-id, amazon id)', max_length=20)
+ identifier = forms.CharField(label='Identifier(ISBN, Google-id, amazon id)', max_length=20)
diff --git a/CalibreWebCompanion/library/models.py b/CalibreWebCompanion/library/models.py
index 0635566..0943333 100644
--- a/CalibreWebCompanion/library/models.py
+++ b/CalibreWebCompanion/library/models.py
@@ -57,7 +57,7 @@ class Data(models.Model):
class Identifier(models.Model):
- book = models.IntegerField()
+ book = models.ForeignKey("Book", db_column="book", on_delete=models.CASCADE)
type = models.TextField()
val = models.TextField()
diff --git a/CalibreWebCompanion/library/templates/search.html b/CalibreWebCompanion/library/templates/search.html
index ba0aad0..7fa03f0 100644
--- a/CalibreWebCompanion/library/templates/search.html
+++ b/CalibreWebCompanion/library/templates/search.html
@@ -8,6 +8,8 @@
+
+
diff --git a/CalibreWebCompanion/library/views.py b/CalibreWebCompanion/library/views.py
index bcfaa30..23a0c49 100644
--- a/CalibreWebCompanion/library/views.py
+++ b/CalibreWebCompanion/library/views.py
@@ -1,6 +1,6 @@
from django.shortcuts import render
from django.views import generic
-from .models import Author, Book, Comment, Rating, BookAuthorLink, Publisher, Tag, BookTagLink, BookRatingLink, Data
+from .models import Author, Book, Comment, Rating, BookAuthorLink, Publisher, Tag, BookTagLink, BookRatingLink, Data, Identifier
from django.http import HttpResponseRedirect
from .forms import SearchForm, UserCreationForm
from django.db import models
@@ -40,11 +40,14 @@ class ResultsView(generic.ListView): # no clue if this is secure.
def get_queryset(self): # new
title = self.request.GET.get('title')
author = self.request.GET.get('author')
+ identifier = self.request.GET.get("identifier")
books = Book.objects.prefetch_related("tags", "ratings")
if title:
books =books.filter(sort__icontains=title)
if author:
books = books.filter(author_sort__icontains=author)
+ if identifier:
+ books = books.filter(identifier__val=identifier)
return books