+ {% trans "Lists" %}
{% if not list_results %}
- {% blocktrans %}No lists found for "{{ query }}"{% endblocktrans %}
+ {% blocktrans %}No lists found for "{{ query }}"{% endblocktrans %}
{% endif %}
{% for result in list_results %}
diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py
index 53ceeaa83..24c80b046 100644
--- a/bookwyrm/urls.py
+++ b/bookwyrm/urls.py
@@ -43,7 +43,7 @@ urlpatterns = [
re_path("^api/updates/notifications/?$", views.get_notification_count),
re_path("^api/updates/stream/(?P[a-z]+)/?$", views.get_unread_status_count),
# authentication
- re_path(r"^login/?$", views.Login.as_view()),
+ re_path(r"^login/?$", views.Login.as_view(), name="login"),
re_path(r"^register/?$", views.Register.as_view()),
re_path(r"^logout/?$", views.Logout.as_view()),
re_path(r"^password-reset/?$", views.PasswordResetRequest.as_view()),
diff --git a/bookwyrm/views/search.py b/bookwyrm/views/search.py
index 4543b55ee..bd5ac3c74 100644
--- a/bookwyrm/views/search.py
+++ b/bookwyrm/views/search.py
@@ -30,27 +30,30 @@ class Search(View):
)
return JsonResponse([r.json() for r in book_results], safe=False)
+ data = {"query": query or ""}
+
# use webfinger for mastodon style account@domain.com username
if query and re.match(regex.full_username, query):
handle_remote_webfinger(query)
# do a user search
- user_results = (
- models.User.viewer_aware_objects(request.user)
- .annotate(
- similarity=Greatest(
- TrigramSimilarity("username", query),
- TrigramSimilarity("localname", query),
+ if request.user.is_authenticated:
+ data["user_results"] = (
+ models.User.viewer_aware_objects(request.user)
+ .annotate(
+ similarity=Greatest(
+ TrigramSimilarity("username", query),
+ TrigramSimilarity("localname", query),
+ )
)
+ .filter(
+ similarity__gt=0.5,
+ )
+ .order_by("-similarity")[:10]
)
- .filter(
- similarity__gt=0.5,
- )
- .order_by("-similarity")[:10]
- )
# any relevent lists?
- list_results = (
+ data["list_results"] = (
privacy_filter(
request.user,
models.List.objects,
@@ -68,11 +71,7 @@ class Search(View):
.order_by("-similarity")[:10]
)
- book_results = connector_manager.search(query, min_confidence=min_confidence)
- data = {
- "book_results": book_results,
- "user_results": user_results,
- "list_results": list_results,
- "query": query or "",
- }
+ data["book_results"] = connector_manager.search(
+ query, min_confidence=min_confidence
+ )
return TemplateResponse(request, "search_results.html", data)
diff --git a/locale/de_DE/LC_MESSAGES/django.po b/locale/de_DE/LC_MESSAGES/django.po
index bbdd13275..d7ad8724e 100644
--- a/locale/de_DE/LC_MESSAGES/django.po
+++ b/locale/de_DE/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-04-29 11:36-0700\n"
+"POT-Creation-Date: 2021-04-29 13:24-0700\n"
"PO-Revision-Date: 2021-03-02 17:19-0800\n"
"Last-Translator: Mouse Reeve \n"
"Language-Team: English \n"
@@ -282,7 +282,7 @@ msgstr "Orte"
#: bookwyrm/templates/book/book.html:220 bookwyrm/templates/layout.html:65
#: bookwyrm/templates/lists/lists.html:5 bookwyrm/templates/lists/lists.html:12
-#: bookwyrm/templates/search_results.html:91
+#: bookwyrm/templates/search_results.html:115
#: bookwyrm/templates/user/user_layout.html:62
msgid "Lists"
msgstr "Listen"
@@ -581,6 +581,7 @@ msgstr "Veröffentlicht von %(publisher)s."
#: bookwyrm/templates/feed/feed_layout.html:70
#: bookwyrm/templates/get_started/layout.html:19
#: bookwyrm/templates/get_started/layout.html:52
+#: bookwyrm/templates/search_results.html:72
msgid "Close"
msgstr "Schließen"
@@ -1129,7 +1130,7 @@ msgid "Search for a user"
msgstr "Suche nach Buch oder Benutzer*in"
#: bookwyrm/templates/get_started/users.html:13
-#: bookwyrm/templates/search_results.html:76
+#: bookwyrm/templates/search_results.html:99
#, python-format
msgid "No users found for \"%(query)s\""
msgstr "Keine Nutzer*innen für \"%(query)s\" gefunden"
@@ -1908,23 +1909,33 @@ msgstr "Profil"
msgid "Relationships"
msgstr "Beziehungen"
-#: bookwyrm/templates/search_results.html:33
+#: bookwyrm/templates/search_results.html:20
+msgid "Log in to import or add books."
+msgstr ""
+
+#: bookwyrm/templates/search_results.html:38
msgid "Didn't find what you were looking for?"
msgstr "Nicht gefunden, wonach du gesucht hast?"
-#: bookwyrm/templates/search_results.html:35
+#: bookwyrm/templates/search_results.html:40
msgid "Show results from other catalogues"
msgstr "Ergebnisse aus anderen Katalogen zeigen"
-#: bookwyrm/templates/search_results.html:62
+#: bookwyrm/templates/search_results.html:44
msgid "Hide results from other catalogues"
msgstr "Ergebnisse aus anderen Katalogen ausblenden"
-#: bookwyrm/templates/search_results.html:74
+#: bookwyrm/templates/search_results.html:63
+#, fuzzy
+#| msgid "Show more"
+msgid "Show"
+msgstr "Mehr anzeigen"
+
+#: bookwyrm/templates/search_results.html:97
msgid "Matching Users"
msgstr "Passende Nutzer*innen"
-#: bookwyrm/templates/search_results.html:93
+#: bookwyrm/templates/search_results.html:117
#, python-format
msgid "No lists found for \"%(query)s\""
msgstr "Keine Liste für \"%(query)s\" gefunden"
diff --git a/locale/en_US/LC_MESSAGES/django.po b/locale/en_US/LC_MESSAGES/django.po
index 3637bb770..c3df47ae1 100644
--- a/locale/en_US/LC_MESSAGES/django.po
+++ b/locale/en_US/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-04-29 11:36-0700\n"
+"POT-Creation-Date: 2021-04-29 13:24-0700\n"
"PO-Revision-Date: 2021-02-28 17:19-0800\n"
"Last-Translator: Mouse Reeve \n"
"Language-Team: English \n"
@@ -261,7 +261,7 @@ msgstr ""
#: bookwyrm/templates/book/book.html:220 bookwyrm/templates/layout.html:65
#: bookwyrm/templates/lists/lists.html:5 bookwyrm/templates/lists/lists.html:12
-#: bookwyrm/templates/search_results.html:91
+#: bookwyrm/templates/search_results.html:115
#: bookwyrm/templates/user/user_layout.html:62
msgid "Lists"
msgstr ""
@@ -535,6 +535,7 @@ msgstr ""
#: bookwyrm/templates/feed/feed_layout.html:70
#: bookwyrm/templates/get_started/layout.html:19
#: bookwyrm/templates/get_started/layout.html:52
+#: bookwyrm/templates/search_results.html:72
msgid "Close"
msgstr ""
@@ -1032,7 +1033,7 @@ msgid "Search for a user"
msgstr ""
#: bookwyrm/templates/get_started/users.html:13
-#: bookwyrm/templates/search_results.html:76
+#: bookwyrm/templates/search_results.html:99
#, python-format
msgid "No users found for \"%(query)s\""
msgstr ""
@@ -1739,23 +1740,31 @@ msgstr ""
msgid "Relationships"
msgstr ""
-#: bookwyrm/templates/search_results.html:33
+#: bookwyrm/templates/search_results.html:20
+msgid "Log in to import or add books."
+msgstr ""
+
+#: bookwyrm/templates/search_results.html:38
msgid "Didn't find what you were looking for?"
msgstr ""
-#: bookwyrm/templates/search_results.html:35
+#: bookwyrm/templates/search_results.html:40
msgid "Show results from other catalogues"
msgstr ""
-#: bookwyrm/templates/search_results.html:62
+#: bookwyrm/templates/search_results.html:44
msgid "Hide results from other catalogues"
msgstr ""
-#: bookwyrm/templates/search_results.html:74
+#: bookwyrm/templates/search_results.html:63
+msgid "Show"
+msgstr ""
+
+#: bookwyrm/templates/search_results.html:97
msgid "Matching Users"
msgstr ""
-#: bookwyrm/templates/search_results.html:93
+#: bookwyrm/templates/search_results.html:117
#, python-format
msgid "No lists found for \"%(query)s\""
msgstr ""
diff --git a/locale/es/LC_MESSAGES/django.po b/locale/es/LC_MESSAGES/django.po
index 8385f7f66..dab4c486f 100644
--- a/locale/es/LC_MESSAGES/django.po
+++ b/locale/es/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-04-29 11:36-0700\n"
+"POT-Creation-Date: 2021-04-29 13:24-0700\n"
"PO-Revision-Date: 2021-03-19 11:49+0800\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -266,7 +266,7 @@ msgstr "Lugares"
#: bookwyrm/templates/book/book.html:220 bookwyrm/templates/layout.html:65
#: bookwyrm/templates/lists/lists.html:5 bookwyrm/templates/lists/lists.html:12
-#: bookwyrm/templates/search_results.html:91
+#: bookwyrm/templates/search_results.html:115
#: bookwyrm/templates/user/user_layout.html:62
msgid "Lists"
msgstr "Listas"
@@ -548,6 +548,7 @@ msgstr "Publicado por %(publisher)s."
#: bookwyrm/templates/feed/feed_layout.html:70
#: bookwyrm/templates/get_started/layout.html:19
#: bookwyrm/templates/get_started/layout.html:52
+#: bookwyrm/templates/search_results.html:72
msgid "Close"
msgstr "Cerrar"
@@ -1060,7 +1061,7 @@ msgid "Search for a user"
msgstr "Buscar un usuario"
#: bookwyrm/templates/get_started/users.html:13
-#: bookwyrm/templates/search_results.html:76
+#: bookwyrm/templates/search_results.html:99
#, python-format
msgid "No users found for \"%(query)s\""
msgstr "No se encontró ningún usuario correspondiente a \"%(query)s\""
@@ -1811,23 +1812,33 @@ msgstr "Perfil"
msgid "Relationships"
msgstr "Relaciones"
-#: bookwyrm/templates/search_results.html:33
+#: bookwyrm/templates/search_results.html:20
+msgid "Log in to import or add books."
+msgstr ""
+
+#: bookwyrm/templates/search_results.html:38
msgid "Didn't find what you were looking for?"
msgstr "¿No encontraste lo que buscabas?"
-#: bookwyrm/templates/search_results.html:35
+#: bookwyrm/templates/search_results.html:40
msgid "Show results from other catalogues"
msgstr "Mostrar resultados de otros catálogos"
-#: bookwyrm/templates/search_results.html:62
+#: bookwyrm/templates/search_results.html:44
msgid "Hide results from other catalogues"
msgstr "Ocultar resultados de otros catálogos"
-#: bookwyrm/templates/search_results.html:74
+#: bookwyrm/templates/search_results.html:63
+#, fuzzy
+#| msgid "Show more"
+msgid "Show"
+msgstr "Mostrar más"
+
+#: bookwyrm/templates/search_results.html:97
msgid "Matching Users"
msgstr "Usuarios correspondientes"
-#: bookwyrm/templates/search_results.html:93
+#: bookwyrm/templates/search_results.html:117
#, python-format
msgid "No lists found for \"%(query)s\""
msgstr "No se encontró ningúna lista correspondiente a \"%(query)s\""
diff --git a/locale/fr_FR/LC_MESSAGES/django.po b/locale/fr_FR/LC_MESSAGES/django.po
index ee7a55344..01963e467 100644
--- a/locale/fr_FR/LC_MESSAGES/django.po
+++ b/locale/fr_FR/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-04-29 11:36-0700\n"
+"POT-Creation-Date: 2021-04-29 13:24-0700\n"
"PO-Revision-Date: 2021-04-05 12:44+0100\n"
"Last-Translator: Fabien Basmaison \n"
"Language-Team: Mouse Reeve \n"
@@ -272,7 +272,7 @@ msgstr "Lieux"
#: bookwyrm/templates/book/book.html:220 bookwyrm/templates/layout.html:65
#: bookwyrm/templates/lists/lists.html:5 bookwyrm/templates/lists/lists.html:12
-#: bookwyrm/templates/search_results.html:91
+#: bookwyrm/templates/search_results.html:115
#: bookwyrm/templates/user/user_layout.html:62
msgid "Lists"
msgstr "Listes"
@@ -554,6 +554,7 @@ msgstr "Publié par %(publisher)s."
#: bookwyrm/templates/feed/feed_layout.html:70
#: bookwyrm/templates/get_started/layout.html:19
#: bookwyrm/templates/get_started/layout.html:52
+#: bookwyrm/templates/search_results.html:72
msgid "Close"
msgstr "Fermer"
@@ -1072,7 +1073,7 @@ msgid "Search for a user"
msgstr "Chercher un compte"
#: bookwyrm/templates/get_started/users.html:13
-#: bookwyrm/templates/search_results.html:76
+#: bookwyrm/templates/search_results.html:99
#, python-format
msgid "No users found for \"%(query)s\""
msgstr "Aucun compte trouvé pour « %(query)s »"
@@ -1836,23 +1837,33 @@ msgstr "Profil"
msgid "Relationships"
msgstr "Relations"
-#: bookwyrm/templates/search_results.html:33
+#: bookwyrm/templates/search_results.html:20
+msgid "Log in to import or add books."
+msgstr ""
+
+#: bookwyrm/templates/search_results.html:38
msgid "Didn't find what you were looking for?"
msgstr "Vous n’avez pas trouvé ce que vous cherchiez ?"
-#: bookwyrm/templates/search_results.html:35
+#: bookwyrm/templates/search_results.html:40
msgid "Show results from other catalogues"
msgstr "Montrer les résultats d’autres catalogues"
-#: bookwyrm/templates/search_results.html:62
+#: bookwyrm/templates/search_results.html:44
msgid "Hide results from other catalogues"
msgstr "Masquer les résultats d’autres catalogues"
-#: bookwyrm/templates/search_results.html:74
+#: bookwyrm/templates/search_results.html:63
+#, fuzzy
+#| msgid "Show more"
+msgid "Show"
+msgstr "Déplier"
+
+#: bookwyrm/templates/search_results.html:97
msgid "Matching Users"
msgstr "Comptes correspondants"
-#: bookwyrm/templates/search_results.html:93
+#: bookwyrm/templates/search_results.html:117
#, python-format
msgid "No lists found for \"%(query)s\""
msgstr "Aucune liste trouvée pour « %(query)s »"
diff --git a/locale/zh_Hans/LC_MESSAGES/django.po b/locale/zh_Hans/LC_MESSAGES/django.po
index af3bc59bd..783fc70ab 100644
--- a/locale/zh_Hans/LC_MESSAGES/django.po
+++ b/locale/zh_Hans/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-04-29 11:36-0700\n"
+"POT-Creation-Date: 2021-04-29 13:24-0700\n"
"PO-Revision-Date: 2021-03-20 00:56+0000\n"
"Last-Translator: Kana \n"
"Language-Team: Mouse Reeve \n"
@@ -270,7 +270,7 @@ msgstr "地点"
#: bookwyrm/templates/book/book.html:220 bookwyrm/templates/layout.html:65
#: bookwyrm/templates/lists/lists.html:5 bookwyrm/templates/lists/lists.html:12
-#: bookwyrm/templates/search_results.html:91
+#: bookwyrm/templates/search_results.html:115
#: bookwyrm/templates/user/user_layout.html:62
msgid "Lists"
msgstr "列表"
@@ -552,6 +552,7 @@ msgstr "由 %(publisher)s 出版。"
#: bookwyrm/templates/feed/feed_layout.html:70
#: bookwyrm/templates/get_started/layout.html:19
#: bookwyrm/templates/get_started/layout.html:52
+#: bookwyrm/templates/search_results.html:72
msgid "Close"
msgstr "关闭"
@@ -1052,7 +1053,7 @@ msgid "Search for a user"
msgstr "搜索用户"
#: bookwyrm/templates/get_started/users.html:13
-#: bookwyrm/templates/search_results.html:76
+#: bookwyrm/templates/search_results.html:99
#, python-format
msgid "No users found for \"%(query)s\""
msgstr "没有找到 \"%(query)s\" 的用户"
@@ -1801,23 +1802,33 @@ msgstr "个人资料"
msgid "Relationships"
msgstr "关系"
-#: bookwyrm/templates/search_results.html:33
+#: bookwyrm/templates/search_results.html:20
+msgid "Log in to import or add books."
+msgstr ""
+
+#: bookwyrm/templates/search_results.html:38
msgid "Didn't find what you were looking for?"
msgstr "没有找到你想找的?"
-#: bookwyrm/templates/search_results.html:35
+#: bookwyrm/templates/search_results.html:40
msgid "Show results from other catalogues"
msgstr "显示其它类别的结果"
-#: bookwyrm/templates/search_results.html:62
+#: bookwyrm/templates/search_results.html:44
msgid "Hide results from other catalogues"
msgstr "隐藏其它类别的结果"
-#: bookwyrm/templates/search_results.html:74
+#: bookwyrm/templates/search_results.html:63
+#, fuzzy
+#| msgid "Show more"
+msgid "Show"
+msgstr "显示更多"
+
+#: bookwyrm/templates/search_results.html:97
msgid "Matching Users"
msgstr "匹配的用户"
-#: bookwyrm/templates/search_results.html:93
+#: bookwyrm/templates/search_results.html:117
#, python-format
msgid "No lists found for \"%(query)s\""
msgstr "没有找到 \"%(query)s\" 的列表"