Store csv in the database and then import via celery.
This commit is contained in:
parent
881cc4d64b
commit
0bf73fef24
10 changed files with 293 additions and 133 deletions
|
@ -1,4 +1,5 @@
|
|||
{% extends 'layout.html' %}
|
||||
{% load humanize %}
|
||||
{% block content %}
|
||||
<div class="content-container">
|
||||
<h2>Import Books from GoodReads</h2>
|
||||
|
@ -6,7 +7,13 @@
|
|||
{% csrf_token %}
|
||||
{{ import_form.as_p }}
|
||||
<button type="submit">Import</button>
|
||||
<small>Hang tight, this may take a minute!</small>
|
||||
</form>
|
||||
|
||||
<h2>Recent Imports</h2>
|
||||
<ul>
|
||||
{% for job in jobs %}
|
||||
<li><a href="/import_status/{{ job.id }}">{{ job.created_date | naturaltime }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
{% extends 'layout.html' %}
|
||||
{% block content %}
|
||||
<div id="content">
|
||||
<div>
|
||||
<h1>Import</h1>
|
||||
|
||||
Import uploaded successfully. The import is being processed.
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
62
fedireads/templates/import_status.html
Normal file
62
fedireads/templates/import_status.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
{% extends 'layout.html' %}
|
||||
{% load fr_display %}
|
||||
{% load humanize %}
|
||||
{% block content %}
|
||||
<div id="content">
|
||||
<div>
|
||||
<h1>Import Status</h1>
|
||||
|
||||
<p>
|
||||
Import started: {{ job.created_date | naturaltime }}
|
||||
<p>
|
||||
{% if task.ready %}
|
||||
Import completed: {{ task.date_done | naturaltime }}
|
||||
{% if task.failed %}
|
||||
<h3><span style="background-color: #ffaaaa;">TASK FAILED</span></h3>
|
||||
<p>
|
||||
{{ task.info }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
Import still in progress.
|
||||
<p>
|
||||
(Hit reload to update!)
|
||||
{% endif %}
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
</th>
|
||||
<th>
|
||||
Title
|
||||
</th>
|
||||
<th>
|
||||
Author
|
||||
</th>
|
||||
<th>
|
||||
Book
|
||||
</th>
|
||||
</tr>
|
||||
{% for item in items %}
|
||||
<tr>
|
||||
<td>
|
||||
{% if item.book %}✓{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ item.data|dict_key:'Title' }}
|
||||
</td>
|
||||
<td>
|
||||
{{ item.data|dict_key:'Author' }}
|
||||
</td>
|
||||
<td>
|
||||
{% if item.book %}
|
||||
<a href="{{ item.book.absolute_id }}">
|
||||
{% include 'snippets/book_cover.html' with book=item.book size='small' %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue