mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 12:01:14 +00:00
Adds update from inventaire link for books
This commit is contained in:
parent
071da7d4fb
commit
02313f40b8
3 changed files with 12 additions and 4 deletions
|
@ -214,7 +214,7 @@ class Connector(AbstractConnector):
|
|||
|
||||
def get_remote_id_from_model(self, obj):
|
||||
"""use get_remote_id to figure out the link from a model obj"""
|
||||
remote_id_value = getattr(obj, self.inventaire_id)
|
||||
remote_id_value = obj.inventaire_id
|
||||
return self.get_remote_id(remote_id_value)
|
||||
|
||||
|
||||
|
|
|
@ -102,7 +102,15 @@
|
|||
</p>
|
||||
{% endif %}
|
||||
{% if book.inventaire_id %}
|
||||
<p><a href="{{ book.inventaire_link }}" target="_blank" rel="noopener">{% trans "View on Inventaire" %}</a></p>
|
||||
<p>
|
||||
<a href="{{ book.inventaire_link }}" target="_blank" rel="noopener">{% trans "View on Inventaire" %}</a>
|
||||
{% if request.user.is_authenticated and perms.bookwyrm.edit_book %}
|
||||
<form name="iv-update" method="POST" action="{% url 'book-update-remote' book.id 'inventaire.io' %}">
|
||||
{% csrf_token %}
|
||||
<button class="button is-small" type="submit">{% trans "Update from Inventaire" %}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
@ -425,12 +425,12 @@ urlpatterns = [
|
|||
re_path(r"^resolve-book/?$", views.resolve_book, name="resolve-book"),
|
||||
re_path(r"^switch-edition/?$", views.switch_edition, name="switch-edition"),
|
||||
re_path(
|
||||
rf"^{BOOK_PATH}/update/(?P<connector_identifier>[\w\.]+)?$",
|
||||
rf"{BOOK_PATH}/update/(?P<connector_identifier>[\w\.]+)/?$",
|
||||
views.update_book_from_remote,
|
||||
name="book-update-remote",
|
||||
),
|
||||
re_path(
|
||||
r"^author/(?P<author_id>\d+)/update/(?P<connector_identifier>[\w\.]+)?$",
|
||||
r"^author/(?P<author_id>\d+)/update/(?P<connector_identifier>[\w\.]+)/?$",
|
||||
views.update_author_from_remote,
|
||||
name="author-update-remote",
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue