mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-11 09:45:27 +00:00
Adds more fields to import admin table and ticks version
This commit is contained in:
parent
3f2f718878
commit
40e9428b49
4 changed files with 25 additions and 4 deletions
|
@ -58,6 +58,16 @@ class ImportJob(models.Model):
|
||||||
"""And how many pending items??"""
|
"""And how many pending items??"""
|
||||||
return self.pending_items.count()
|
return self.pending_items.count()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def successful_item_count(self):
|
||||||
|
"""How many found a book?"""
|
||||||
|
return self.items.filter(book__isnull=False).count()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def failed_item_count(self):
|
||||||
|
"""How many found a book?"""
|
||||||
|
return self.items.filter(fail_reason__isnull=False).count()
|
||||||
|
|
||||||
|
|
||||||
class ImportItem(models.Model):
|
class ImportItem(models.Model):
|
||||||
"""a single line of a csv being imported"""
|
"""a single line of a csv being imported"""
|
||||||
|
|
|
@ -11,7 +11,7 @@ from django.utils.translation import gettext_lazy as _
|
||||||
env = Env()
|
env = Env()
|
||||||
env.read_env()
|
env.read_env()
|
||||||
DOMAIN = env("DOMAIN")
|
DOMAIN = env("DOMAIN")
|
||||||
VERSION = "0.4.5"
|
VERSION = "0.4.6"
|
||||||
|
|
||||||
RELEASE_API = env(
|
RELEASE_API = env(
|
||||||
"RELEASE_API",
|
"RELEASE_API",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{% extends 'settings/layout.html' %}
|
{% extends 'settings/layout.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load utilities %}
|
{% load utilities %}
|
||||||
|
{% load humanize %}
|
||||||
|
|
||||||
{% block title %}{% trans "Imports" %}{% endblock %}
|
{% block title %}{% trans "Imports" %}{% endblock %}
|
||||||
|
|
||||||
|
@ -54,6 +55,12 @@
|
||||||
<th>
|
<th>
|
||||||
{% trans "Pending items" %}
|
{% trans "Pending items" %}
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
{% trans "Successful items" %}
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
{% trans "Failed items" %}
|
||||||
|
</th>
|
||||||
{% if status == "active" %}
|
{% if status == "active" %}
|
||||||
<th>{% trans "Actions" %}</th>
|
<th>{% trans "Actions" %}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -68,8 +75,10 @@
|
||||||
{% if status != "active" %}
|
{% if status != "active" %}
|
||||||
<td>{{ import.updated_date }}</td>
|
<td>{{ import.updated_date }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td>{{ import.item_count }}</td>
|
<td>{{ import.item_count|intcomma }}</td>
|
||||||
<td>{{ import.pending_item_count }}</td>
|
<td>{{ import.pending_item_count|intcomma }}</td>
|
||||||
|
<td>{{ import.successful_item_count|intcomma }}</td>
|
||||||
|
<td>{{ import.failed_item_count|intcomma }}</td>
|
||||||
{% if status == "active" %}
|
{% if status == "active" %}
|
||||||
<td>
|
<td>
|
||||||
{% join "complete" import.id as modal_id %}
|
{% join "complete" import.id as modal_id %}
|
||||||
|
|
|
@ -22,7 +22,9 @@ class ImportList(View):
|
||||||
def get(self, request, status="active"):
|
def get(self, request, status="active"):
|
||||||
"""list of imports"""
|
"""list of imports"""
|
||||||
complete = status == "complete"
|
complete = status == "complete"
|
||||||
imports = models.ImportJob.objects.filter(complete=complete)
|
imports = models.ImportJob.objects.filter(complete=complete).order_by(
|
||||||
|
"created_date"
|
||||||
|
)
|
||||||
paginated = Paginator(imports, PAGE_LENGTH)
|
paginated = Paginator(imports, PAGE_LENGTH)
|
||||||
page = paginated.get_page(request.GET.get("page"))
|
page = paginated.get_page(request.GET.get("page"))
|
||||||
data = {
|
data = {
|
||||||
|
|
Loading…
Reference in a new issue