Renames add link view
This commit is contained in:
@ -37,7 +37,7 @@ from .books.books import (
|
||||
from .books.books import update_book_from_remote
|
||||
from .books.edit_book import EditBook, ConfirmEditBook
|
||||
from .books.editions import Editions, switch_edition
|
||||
from .books.links import FileLink
|
||||
from .books.links import AddFileLink
|
||||
|
||||
# landing
|
||||
from .landing.about import about, privacy, conduct
|
||||
|
@ -7,7 +7,6 @@ from django.views import View
|
||||
from django.utils.decorators import method_decorator
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.activitypub import ActivitypubResponse
|
||||
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
@ -15,18 +14,14 @@ from bookwyrm.activitypub import ActivitypubResponse
|
||||
@method_decorator(
|
||||
permission_required("bookwyrm.edit_book", raise_exception=True), name="dispatch"
|
||||
)
|
||||
class FileLink(View):
|
||||
class AddFileLink(View):
|
||||
"""a book! this is the stuff"""
|
||||
|
||||
def get(self, request, book_id=None, link_id=None):
|
||||
"""info about a book"""
|
||||
link = get_object_or_404(models.FileLink, id=link_id) if link_id else None
|
||||
if not book_id:
|
||||
return ActivitypubResponse(link.to_activity())
|
||||
|
||||
def get(self, request, book_id):
|
||||
"""Create link form"""
|
||||
book = get_object_or_404(models.Edition, id=book_id)
|
||||
data = {
|
||||
"file_link_form": forms.FileLinkForm(instance=link),
|
||||
"file_link_form": forms.FileLinkForm(),
|
||||
"book": book,
|
||||
}
|
||||
return TemplateResponse(request, "book/file_link_page.html", data)
|
||||
|
Reference in New Issue
Block a user