Commit d46f86fc authored by Alain St-Denis's avatar Alain St-Denis
Browse files

Resolve "search by unicode tags fails" (#607) by adding code to deal with...

Resolve "search by unicode tags fails" (#607) by adding code to deal with tag-by-uuid in streams/viewsets.py and streams/urls/api.py.
parent b5ad70f0
......@@ -15,6 +15,7 @@ Changed
Fixed
.....
* Add the code to deal with tag-by-uuid in the streams/viewsets.py and streams/urls/api.py. (`#607 <https://git.feneas.org/socialhome/socialhome/issues/607>`_)
0.13.0 (2021-08-15)
-------------------
......
......@@ -16,6 +16,7 @@
"bootstrap": "<5",
"bootstrap-vue": "2.21.2",
"easymde": "^2.15.0",
"fitvids": "^2.1.1",
"fork-awesome": "^1.1.7",
"js-cookie": "^3.0.0",
"lodash": "^4.17.21",
......
......@@ -13,6 +13,7 @@ urlpatterns = [
url(r"^profile-all/(?P<uuid>[0-9a-f-]+)/$", ProfileAllStreamAPIView.as_view(), name="profile-all"),
url(r"^profile-pinned/(?P<uuid>[0-9a-f-]+)/$", ProfilePinnedStreamAPIView.as_view(), name="profile-pinned"),
url(r"^public/$", PublicStreamAPIView.as_view(), name="public"),
url(r"^tag/uuid-(?P<uuid>[^/]+)/$", TagStreamAPIView.as_view(), name="tag-by-uuid"),
url(r"^tag/(?P<name>[\w-]+)/$", TagStreamAPIView.as_view(), name="tag"),
url(r"^tags/$", TagsStreamAPIView.as_view(), name="tags"),
]
......@@ -82,7 +82,13 @@ class PublicStreamAPIView(StreamsAPIBaseView):
class TagStreamAPIView(StreamsAPIBaseView):
def dispatch(self, request, *args, **kwargs):
self.tag = get_object_or_404(Tag, name=kwargs.get("name"))
if kwargs.get("name"):
arguments = {"name": kwargs.get("name")}
elif kwargs.get("uuid"):
arguments = {"uuid": kwargs.get("uuid")}
else:
raise Http404
self.tag = get_object_or_404(Tag, **arguments)
return super().dispatch(request, *args, **kwargs)
def get_content(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment