forked from mirrors/bookwyrm
Merge branch 'large_imports' of https://github.com/cthulahoops/fedireads into cthulahoops-large_imports
This commit is contained in:
commit
a321ef2a82
4 changed files with 8 additions and 4 deletions
|
@ -7,8 +7,8 @@ from fedireads.tasks import app
|
||||||
from fedireads.models import ImportJob, ImportItem
|
from fedireads.models import ImportJob, ImportItem
|
||||||
from fedireads.status import create_notification
|
from fedireads.status import create_notification
|
||||||
|
|
||||||
# TODO: remove or notify about this in the UI
|
# TODO: remove or increase once we're confident it's not causing problems.
|
||||||
MAX_ENTRIES = 20
|
MAX_ENTRIES = 500
|
||||||
|
|
||||||
|
|
||||||
def create_job(user, csv_file):
|
def create_job(user, csv_file):
|
||||||
|
|
|
@ -61,7 +61,7 @@ class ImportItem(models.Model):
|
||||||
def get_book_from_db_isbn(self):
|
def get_book_from_db_isbn(self):
|
||||||
''' see if we already know about the book '''
|
''' see if we already know about the book '''
|
||||||
try:
|
try:
|
||||||
return Edition.objects.get(isbn=self.isbn)
|
return Edition.objects.filter(isbn=self.isbn).first()
|
||||||
except Edition.DoesNotExist:
|
except Edition.DoesNotExist:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class ImportItem(models.Model):
|
||||||
def shelf(self):
|
def shelf(self):
|
||||||
''' the goodreads shelf field '''
|
''' the goodreads shelf field '''
|
||||||
if self.data['Exclusive Shelf']:
|
if self.data['Exclusive Shelf']:
|
||||||
return GOODREADS_SHELVES[self.data['Exclusive Shelf']]
|
return GOODREADS_SHELVES.get(self.data['Exclusive Shelf'])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def review(self):
|
def review(self):
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
{{ import_form.as_p }}
|
{{ import_form.as_p }}
|
||||||
<button type="submit">Import</button>
|
<button type="submit">Import</button>
|
||||||
</form>
|
</form>
|
||||||
|
<p>
|
||||||
|
Imports are limited in size, and only the first {{ limit }} items will be imported.
|
||||||
|
|
||||||
<h2>Recent Imports</h2>
|
<h2>Recent Imports</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -9,6 +9,7 @@ from django.views.decorators.csrf import csrf_exempt
|
||||||
|
|
||||||
from fedireads import activitypub
|
from fedireads import activitypub
|
||||||
from fedireads import forms, models, books_manager
|
from fedireads import forms, models, books_manager
|
||||||
|
from fedireads import goodreads_import
|
||||||
from fedireads.tasks import app
|
from fedireads.tasks import app
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,6 +163,7 @@ def import_page(request):
|
||||||
'import_form': forms.ImportForm(),
|
'import_form': forms.ImportForm(),
|
||||||
'jobs': models.ImportJob.
|
'jobs': models.ImportJob.
|
||||||
objects.filter(user=request.user).order_by('-created_date'),
|
objects.filter(user=request.user).order_by('-created_date'),
|
||||||
|
'limit': goodreads_import.MAX_ENTRIES,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue