mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-22 15:08:07 +00:00
Renames class view
This commit is contained in:
parent
68d943fb26
commit
4ca90ca10f
5 changed files with 14 additions and 4 deletions
|
@ -479,6 +479,7 @@ class SortListForm(forms.Form):
|
|||
),
|
||||
)
|
||||
|
||||
|
||||
class ReadThroughForm(CustomForm):
|
||||
def clean(self):
|
||||
"""make sure the email isn't in use by a registered user"""
|
||||
|
|
|
@ -457,7 +457,7 @@ urlpatterns = [
|
|||
# reading progress
|
||||
re_path(r"^edit-readthrough/?$", views.edit_readthrough, name="edit-readthrough"),
|
||||
re_path(r"^delete-readthrough/?$", views.delete_readthrough),
|
||||
re_path(r"^create-readthrough/?$", views.CreateReadThrough.as_view(), name="create-readthrough"),
|
||||
re_path(r"^create-readthrough/?$", views.ReadThrough.as_view(), name="create-readthrough"),
|
||||
re_path(r"^delete-progressupdate/?$", views.delete_progressupdate),
|
||||
# shelve actions
|
||||
re_path(
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue