Renames class view
This commit is contained in:
@ -88,7 +88,7 @@ from .list import Lists, SavedLists, List, Curate, UserLists
|
||||
from .list import save_list, unsave_list, delete_list, unsafe_embed_list
|
||||
from .notifications import Notifications
|
||||
from .outbox import Outbox
|
||||
from .reading import CreateReadThrough, delete_readthrough, delete_progressupdate
|
||||
from .reading import ReadThrough, delete_readthrough, delete_progressupdate
|
||||
from .reading import ReadingStatus
|
||||
from .rss_feed import RssFeed
|
||||
from .search import Search
|
||||
|
@ -116,10 +116,18 @@ class ReadingStatus(View):
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
class CreateReadThrough(View):
|
||||
class ReadThrough(View):
|
||||
"""Add new read dates"""
|
||||
def get(self, request):
|
||||
def get(self, request, book_id, readthrough_id=None):
|
||||
"""standalone form in case of errors"""
|
||||
book = get_object_or_404(models.Edition, id=book_id)
|
||||
form = forms.ReadThroughForm()
|
||||
data = {"form": form, "book": book}
|
||||
if readthrough_id:
|
||||
data["readthrough"] = get_object_or_404(
|
||||
models.ReadThrough, id=readthrough_id
|
||||
)
|
||||
return TemplateResponse(request, "readthrough/readthrough.html", data)
|
||||
|
||||
|
||||
def post(self, request):
|
||||
|
@ -159,6 +159,7 @@ def update_progress(request, book_id): # pylint: disable=unused-argument
|
||||
@require_POST
|
||||
def edit_readthrough(request):
|
||||
"""can't use the form because the dates are too finnicky"""
|
||||
# TODO: remove this, it duplicates the code in the ReadThrough view
|
||||
readthrough = get_object_or_404(models.ReadThrough, id=request.POST.get("id"))
|
||||
readthrough.raise_not_editable(request.user)
|
||||
|
||||
|
Reference in New Issue
Block a user