1
0
Fork 0
This commit is contained in:
Hugh Rundle 2022-08-28 17:30:46 +10:00
parent f219851f3a
commit 18d3d2f85d
2 changed files with 8 additions and 4 deletions

View file

@ -32,7 +32,7 @@ def isbn_search(query):
return []
# Up-case the ISBN string to ensure any 'X' check-digit is correct
# If the ISBN has only 9 characters, prepend missing zero
query = query.strip().upper().rjust(10, '0')
query = query.strip().upper().rjust(10, "0")
filters = [{f: query} for f in ["isbn_10", "isbn_13"]]
results = models.Edition.objects.filter(
reduce(operator.or_, (Q(**f) for f in filters))