forked from mirrors/bookwyrm
Python formatting
This commit is contained in:
parent
7bb634b71f
commit
d1183fd003
3 changed files with 11 additions and 7 deletions
|
@ -226,9 +226,7 @@ def set_related_field(
|
||||||
# edition.parentWork = instance, for example
|
# edition.parentWork = instance, for example
|
||||||
model_field = getattr(model, related_field_name)
|
model_field = getattr(model, related_field_name)
|
||||||
if hasattr(model_field, "activitypub_field"):
|
if hasattr(model_field, "activitypub_field"):
|
||||||
setattr(
|
setattr(activity, getattr(model_field, "activitypub_field"), instance.remote_id)
|
||||||
activity, getattr(model_field, "activitypub_field"), instance.remote_id
|
|
||||||
)
|
|
||||||
item = activity.to_model()
|
item = activity.to_model()
|
||||||
|
|
||||||
# if the related field isn't serialized (attachments on Status), then
|
# if the related field isn't serialized (attachments on Status), then
|
||||||
|
|
|
@ -157,7 +157,7 @@ class InboxUpdate(TestCase):
|
||||||
link_data = {
|
link_data = {
|
||||||
"href": "https://openlibrary.org/books/OL11645413M/Queen_Victoria/daisy",
|
"href": "https://openlibrary.org/books/OL11645413M/Queen_Victoria/daisy",
|
||||||
"mediaType": "Daisy",
|
"mediaType": "Daisy",
|
||||||
"attributedTo": self.remote_user.remote_id
|
"attributedTo": self.remote_user.remote_id,
|
||||||
}
|
}
|
||||||
bookdata["fileLinks"] = [link_data]
|
bookdata["fileLinks"] = [link_data]
|
||||||
|
|
||||||
|
@ -169,7 +169,9 @@ class InboxUpdate(TestCase):
|
||||||
)
|
)
|
||||||
self.assertFalse(book.file_links.exists())
|
self.assertFalse(book.file_links.exists())
|
||||||
|
|
||||||
with patch("bookwyrm.activitypub.base_activity.set_related_field.delay") as mock:
|
with patch(
|
||||||
|
"bookwyrm.activitypub.base_activity.set_related_field.delay"
|
||||||
|
) as mock:
|
||||||
views.inbox.activity_task(
|
views.inbox.activity_task(
|
||||||
{
|
{
|
||||||
"type": "Update",
|
"type": "Update",
|
||||||
|
|
|
@ -16,7 +16,9 @@ class BookFileLinks(View):
|
||||||
def get(self, request, book_id):
|
def get(self, request, book_id):
|
||||||
"""view links"""
|
"""view links"""
|
||||||
book = get_object_or_404(models.Edition, id=book_id)
|
book = get_object_or_404(models.Edition, id=book_id)
|
||||||
return TemplateResponse(request, "book/file_links/edit_links.html", {"book": book})
|
return TemplateResponse(
|
||||||
|
request, "book/file_links/edit_links.html", {"book": book}
|
||||||
|
)
|
||||||
|
|
||||||
def post(self, request, book_id, link_id):
|
def post(self, request, book_id, link_id):
|
||||||
"""delete link"""
|
"""delete link"""
|
||||||
|
@ -49,7 +51,9 @@ class AddFileLink(View):
|
||||||
form = forms.FileLinkForm(request.POST, instance=link)
|
form = forms.FileLinkForm(request.POST, instance=link)
|
||||||
if not form.is_valid():
|
if not form.is_valid():
|
||||||
data = {"file_link_form": form, "book": book}
|
data = {"file_link_form": form, "book": book}
|
||||||
return TemplateResponse(request, "book/file_links/file_link_page.html", data)
|
return TemplateResponse(
|
||||||
|
request, "book/file_links/file_link_page.html", data
|
||||||
|
)
|
||||||
|
|
||||||
link = form.save()
|
link = form.save()
|
||||||
book.file_links.add(link)
|
book.file_links.add(link)
|
||||||
|
|
Loading…
Reference in a new issue