mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 19:41:11 +00:00
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
|
||||
model_field = getattr(model, related_field_name)
|
||||
if hasattr(model_field, "activitypub_field"):
|
||||
setattr(
|
||||
activity, getattr(model_field, "activitypub_field"), instance.remote_id
|
||||
)
|
||||
setattr(activity, getattr(model_field, "activitypub_field"), instance.remote_id)
|
||||
item = activity.to_model()
|
||||
|
||||
# if the related field isn't serialized (attachments on Status), then
|
||||
|
|
|
@ -157,7 +157,7 @@ class InboxUpdate(TestCase):
|
|||
link_data = {
|
||||
"href": "https://openlibrary.org/books/OL11645413M/Queen_Victoria/daisy",
|
||||
"mediaType": "Daisy",
|
||||
"attributedTo": self.remote_user.remote_id
|
||||
"attributedTo": self.remote_user.remote_id,
|
||||
}
|
||||
bookdata["fileLinks"] = [link_data]
|
||||
|
||||
|
@ -169,7 +169,9 @@ class InboxUpdate(TestCase):
|
|||
)
|
||||
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(
|
||||
{
|
||||
"type": "Update",
|
||||
|
|
|
@ -16,7 +16,9 @@ class BookFileLinks(View):
|
|||
def get(self, request, book_id):
|
||||
"""view links"""
|
||||
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):
|
||||
"""delete link"""
|
||||
|
@ -49,7 +51,9 @@ class AddFileLink(View):
|
|||
form = forms.FileLinkForm(request.POST, instance=link)
|
||||
if not form.is_valid():
|
||||
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()
|
||||
book.file_links.add(link)
|
||||
|
|
Loading…
Reference in a new issue