mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Show failed books
This commit is contained in:
parent
799496bb86
commit
032ce8efba
2 changed files with 26 additions and 4 deletions
|
@ -26,7 +26,24 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if failed_items %}
|
||||||
<div class="block">
|
<div class="block">
|
||||||
|
<h2 class="title is-4">Failed to load</h2>
|
||||||
|
<ul>
|
||||||
|
{% for item in failed_items %}
|
||||||
|
<li>
|
||||||
|
Line {{ item.index }}:
|
||||||
|
<strong>{{ item.data|dict_key:'Title' }}</strong> by
|
||||||
|
{{ item.data|dict_key:'Author' }}
|
||||||
|
({{ item.fail_reason }})
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<h2 class="title is-4">Successfully imported</h2>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
|
@ -57,9 +74,10 @@
|
||||||
{{ item.data|dict_key:'Author' }}
|
{{ item.data|dict_key:'Author' }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if item.book %}✓
|
{% if item.book %}
|
||||||
{% elif item.fail_reason %}
|
<span class="icon icon-check">
|
||||||
{{ item.fail_reason }}
|
<span class="is-sr-only">Imported</span>
|
||||||
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -209,10 +209,14 @@ def import_status(request, job_id):
|
||||||
if job.user != request.user:
|
if job.user != request.user:
|
||||||
raise PermissionDenied
|
raise PermissionDenied
|
||||||
task = app.AsyncResult(job.task_id)
|
task = app.AsyncResult(job.task_id)
|
||||||
|
items = job.items.order_by('index').all()
|
||||||
|
failed_items = [i for i in items if i.fail_reason]
|
||||||
|
items = [i for i in items if not i.fail_reason]
|
||||||
return TemplateResponse(request, 'import_status.html', {
|
return TemplateResponse(request, 'import_status.html', {
|
||||||
'title': 'Import Status',
|
'title': 'Import Status',
|
||||||
'job': job,
|
'job': job,
|
||||||
'items': job.items.order_by('index').all(),
|
'items': items,
|
||||||
|
'failed_items': failed_items,
|
||||||
'task': task
|
'task': task
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue