refactor isni author enrichment

- use activitypub.Author instead of custom dict
- prefer to display "Author of [title]" from ISNI data instead of short description
- merge isni and db authors for edit_book display
- fix edit_book template to use changed data
- rename some functions in utils/isni.py
This commit is contained in:
Hugh Rundle
2021-11-22 08:49:22 +11:00
parent e2836d468d
commit fd2ade2313
4 changed files with 50 additions and 53 deletions

View File

@ -56,24 +56,19 @@
{% blocktrans with name=author.name %}Is "{{ name }}" one of these authors?{% endblocktrans %}
</legend>
{% with forloop.counter0 as counter %}
{% if author.isni_matches %}
{% for isni_match in author.isni_matches %}
<label class="label mt-2">
<input type="radio" name="author_match-{{ counter }}" value="isni_match_{{ isni_match.author.isni }}" required>
{{ isni_match.author.name }}
</label>
<p class="help ml-5 mb-2">
<a href="{{ isni_match.author.id }}" target="_blank" rel="noopener noreferrer">{{ isni_match.description }}</a>
</p>
{% endfor %}
{% endif %}
{% for match in author.matches %}
<label class="label">
<input type="radio" name="author_match-{{ counter }}" value="{{ match.id }}" required>
{{ match.name }}
</label>
<p class="help ml-5 mb-2">
<a href="{{ match.local_path }}" target="_blank">{% blocktrans with book_title=match.book_set.first.title %}Author of <em>{{ book_title }}</em>{% endblocktrans %}</a>
{% with book_title=match.book_set.first.title alt_title=match.bio %}
{% if book_title %}
<a href="{{ match.local_path }}" target="_blank">{% trans "Author of " %}<em>{{ book_title }}</em></a>
{% else %}
<a href="{{ match.id }}" target="_blank">{% trans "Author of " %}<em>{{ alt_title }}</em></a>
{% endif %}
{% endwith %}
</p>
<p class="help ml-5">
{{ author.existing_isnis|get_isni_bio:match }}