Fix pylint error and code format

This commit is contained in:
Carlos Camara 2024-01-06 09:53:22 +01:00
parent 93cab480d6
commit ce18d343e8

View file

@ -17,7 +17,7 @@ from bookwyrm import models
from bookwyrm.models.bookwyrm_export_job import BookwyrmExportJob from bookwyrm.models.bookwyrm_export_job import BookwyrmExportJob
from bookwyrm.settings import PAGE_LENGTH from bookwyrm.settings import PAGE_LENGTH
# pylint: disable=no-self-use # pylint: disable=no-self-use,too-many-locals
@method_decorator(login_required, name="dispatch") @method_decorator(login_required, name="dispatch")
class Export(View): class Export(View):
"""Let users export data""" """Let users export data"""
@ -73,13 +73,21 @@ class Export(View):
readthrough = ( readthrough = (
models.ReadThrough.objects.filter(user=request.user, book=book) models.ReadThrough.objects.filter(user=request.user, book=book)
.order_by("-start_date","-finish_date") .order_by("-start_date", "-finish_date")
.first() .first()
) )
if readthrough: if readthrough:
book.start_date = readthrough.start_date.date() if readthrough.start_date else None book.start_date = (
book.finish_date = readthrough.finish_date.date() if readthrough.finish_date else None readthrough.start_date.date() if readthrough.start_date else None
book.stopped_date = readthrough.stopped_date.date() if readthrough.stopped_date else None )
book.finish_date = (
readthrough.finish_date.date() if readthrough.finish_date else None
)
book.stopped_date = (
readthrough.stopped_date.date()
if readthrough.stopped_date
else None
)
review = ( review = (
models.Review.objects.filter( models.Review.objects.filter(
@ -103,7 +111,7 @@ class Export(View):
) )
# pylint: disable=no-self-use,too-many-locals # pylint: disable=no-self-use
@method_decorator(login_required, name="dispatch") @method_decorator(login_required, name="dispatch")
class ExportUser(View): class ExportUser(View):
"""Let users export user data to import into another Bookwyrm instance""" """Let users export user data to import into another Bookwyrm instance"""