mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-13 01:25:21 +00:00
black
This commit is contained in:
parent
2b483488aa
commit
440e2f8806
5 changed files with 15 additions and 6 deletions
|
@ -404,7 +404,9 @@ urlpatterns = [
|
||||||
re_path(r"^list/?$", views.Lists.as_view(), name="lists"),
|
re_path(r"^list/?$", views.Lists.as_view(), name="lists"),
|
||||||
re_path(r"^list/saved/?$", views.SavedLists.as_view(), name="saved-lists"),
|
re_path(r"^list/saved/?$", views.SavedLists.as_view(), name="saved-lists"),
|
||||||
re_path(rf"^list/(?P<list_id>\d+)(\.json)?/?$", views.List.as_view(), name="list"),
|
re_path(rf"^list/(?P<list_id>\d+)(\.json)?/?$", views.List.as_view(), name="list"),
|
||||||
re_path(rf"^list/(?P<list_id>\d+){regex.SLUG}/?$", views.List.as_view(), name="list"),
|
re_path(
|
||||||
|
rf"^list/(?P<list_id>\d+){regex.SLUG}/?$", views.List.as_view(), name="list"
|
||||||
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^list/(?P<list_id>\d+)/item/(?P<list_item>\d+)/?$",
|
r"^list/(?P<list_id>\d+)/item/(?P<list_item>\d+)/?$",
|
||||||
views.ListItem.as_view(),
|
views.ListItem.as_view(),
|
||||||
|
@ -561,7 +563,9 @@ urlpatterns = [
|
||||||
rf"^author/(?P<author_id>\d+)(.json)?/?$", views.Author.as_view(), name="author"
|
rf"^author/(?P<author_id>\d+)(.json)?/?$", views.Author.as_view(), name="author"
|
||||||
),
|
),
|
||||||
re_path(
|
re_path(
|
||||||
rf"^author/(?P<author_id>\d+){regex.SLUG}/?$", views.Author.as_view(), name="author"
|
rf"^author/(?P<author_id>\d+){regex.SLUG}/?$",
|
||||||
|
views.Author.as_view(),
|
||||||
|
name="author",
|
||||||
),
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^author/(?P<author_id>\d+)/edit/?$",
|
r"^author/(?P<author_id>\d+)/edit/?$",
|
||||||
|
|
|
@ -30,7 +30,11 @@ class Book(View):
|
||||||
)
|
)
|
||||||
return ActivitypubResponse(book.to_activity())
|
return ActivitypubResponse(book.to_activity())
|
||||||
|
|
||||||
user_statuses = kwargs.get("user_statuses", False) if request.user.is_authenticated else False
|
user_statuses = (
|
||||||
|
kwargs.get("user_statuses", False)
|
||||||
|
if request.user.is_authenticated
|
||||||
|
else False
|
||||||
|
)
|
||||||
|
|
||||||
# it's safe to use this OR because edition and work and subclasses of the same
|
# it's safe to use this OR because edition and work and subclasses of the same
|
||||||
# table, so they never have clashing IDs
|
# table, so they never have clashing IDs
|
||||||
|
|
|
@ -203,6 +203,7 @@ def filter_stream_by_status_type(activities, allowed_types=None):
|
||||||
|
|
||||||
return activities
|
return activities
|
||||||
|
|
||||||
|
|
||||||
def maybe_redirect_local_path(request, model):
|
def maybe_redirect_local_path(request, model):
|
||||||
"""
|
"""
|
||||||
if the request had an invalid path, return a permanent redirect response to the correct one, including a slug if any.
|
if the request had an invalid path, return a permanent redirect response to the correct one, including a slug if any.
|
||||||
|
|
|
@ -37,7 +37,7 @@ class List(View):
|
||||||
return ActivitypubResponse(book_list.to_activity(**request.GET))
|
return ActivitypubResponse(book_list.to_activity(**request.GET))
|
||||||
|
|
||||||
if r := maybe_redirect_local_path(request, book_list):
|
if r := maybe_redirect_local_path(request, book_list):
|
||||||
return r;
|
return r
|
||||||
|
|
||||||
query = request.GET.get("q")
|
query = request.GET.get("q")
|
||||||
suggestions = None
|
suggestions = None
|
||||||
|
|
Loading…
Reference in a new issue