mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 08:36:32 +00:00
check isni sources when editing book authors
This commit is contained in:
parent
625cfac76f
commit
f2e4865adf
2 changed files with 23 additions and 1 deletions
|
@ -50,6 +50,24 @@
|
|||
<input type="hidden" name="author-match-count" value="{{ author_matches|length }}">
|
||||
<div class="column is-half">
|
||||
{% for author in author_matches %}
|
||||
{% if author.isni_matches %}
|
||||
<fieldset>
|
||||
<legend class="title is-5 mb-1">
|
||||
{% blocktrans with name=author.name %}Is "{{ name }}" one of these?{% endblocktrans %}
|
||||
</legend>
|
||||
{% with forloop.counter0 as counter %}
|
||||
{% for match in author.isni_matches %}
|
||||
<label class="label mb-2">
|
||||
<input type="radio" name="author_match-{{ counter }}" value="{{ match.id }}" required>
|
||||
{{ match.name }}
|
||||
<span class="help">
|
||||
<a href="{{ match.uri }}" target="_blank"><em>{{ match.description }}</em></a>
|
||||
</span>
|
||||
</label>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
<fieldset>
|
||||
<legend class="title is-5 mb-1">
|
||||
{% blocktrans with name=author.name %}Is "{{ name }}" an existing author?{% endblocktrans %}
|
||||
|
|
|
@ -13,7 +13,7 @@ from django.views import View
|
|||
from bookwyrm import book_search, forms, models
|
||||
from bookwyrm.views.helpers import get_edition
|
||||
from .books import set_cover_from_url
|
||||
|
||||
from bookwyrm.utils.isni import find_authors_by_name
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
|
@ -48,6 +48,7 @@ class EditBook(View):
|
|||
if add_author:
|
||||
data["add_author"] = add_author
|
||||
data["author_matches"] = []
|
||||
data["isni_matches"] = []
|
||||
for author in add_author.split(","):
|
||||
if not author:
|
||||
continue
|
||||
|
@ -65,6 +66,9 @@ class EditBook(View):
|
|||
.filter(rank__gt=0.4)
|
||||
.order_by("-rank")[:5]
|
||||
),
|
||||
"isni_matches": find_authors_by_name(
|
||||
author
|
||||
), # find matches from ISNI API
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue