Merge branch 'main' of https://github.com/neodb-social/neodb
This commit is contained in:
commit
b0ec90060a
6 changed files with 613 additions and 526 deletions
|
@ -178,7 +178,11 @@ class JournalSearchResult(SearchResult):
|
|||
[],
|
||||
)
|
||||
)
|
||||
items = Item.objects.filter(pk__in=ids, is_deleted=False)
|
||||
select = {f"id_{i}": f"id={i}" for i in ids}
|
||||
order = [f"-id_{i}" for i in ids]
|
||||
items = Item.objects.filter(pk__in=ids, is_deleted=False).extra(
|
||||
select=select, order_by=order
|
||||
)
|
||||
items = [j for j in [i.final_item for i in items] if not j.is_deleted]
|
||||
return items
|
||||
|
||||
|
@ -197,7 +201,9 @@ class JournalSearchResult(SearchResult):
|
|||
],
|
||||
[],
|
||||
)
|
||||
ps = Piece.objects.filter(pk__in=ids)
|
||||
select = {f"id_{i}": f"id={i}" for i in ids}
|
||||
order = [f"-id_{i}" for i in ids]
|
||||
ps = Piece.objects.filter(pk__in=ids).extra(select=select, order_by=order)
|
||||
return ps
|
||||
|
||||
@cached_property
|
||||
|
|
|
@ -50,6 +50,10 @@ def html_to_text(h: str) -> str:
|
|||
)
|
||||
|
||||
|
||||
def has_spoiler(s: str) -> bool:
|
||||
return ">!" in s
|
||||
|
||||
|
||||
def _spolier(s: str) -> str:
|
||||
sl = s.split(">!", 1)
|
||||
if len(sl) == 1:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% load i18n %}
|
||||
<aside class="grid__aside bottom">
|
||||
<p>
|
||||
{% trans 'Addtional filters may be added to query' %}
|
||||
<details open>
|
||||
<summary>{% trans 'Search filters' %}</summary>
|
||||
<li>
|
||||
<code>status:complete</code> - {% trans 'filter by one of these statuses' %}: <code>wishlist</code> / <code>progress</code> / <code>complete</code> / <code>dropped</code>
|
||||
</li>
|
||||
|
@ -29,5 +29,8 @@
|
|||
<li>
|
||||
<code>date:2022..2023</code> - {% trans 'filter by date range' %}
|
||||
</li>
|
||||
</p>
|
||||
<li>
|
||||
<code>sort:date</code> - {% trans "sort by one of these fields" %}: <code>date</code> ({% trans "from new to old" %}) / <code>rating</code> ({% trans "from high to low" %})
|
||||
</li>
|
||||
</details>
|
||||
</aside>
|
||||
|
|
|
@ -14,7 +14,7 @@ from django.views.decorators.http import require_http_methods
|
|||
|
||||
from catalog.models import *
|
||||
from common.utils import AuthedHttpRequest, get_uuid_or_404
|
||||
from journal.models.renderers import convert_leading_space_in_md, render_md
|
||||
from journal.models.renderers import convert_leading_space_in_md, has_spoiler, render_md
|
||||
from users.middlewares import activate_language_for_user
|
||||
from users.models.apidentity import APIdentity
|
||||
|
||||
|
@ -135,9 +135,12 @@ class ReviewFeed(Feed):
|
|||
return reviews
|
||||
|
||||
def item_title(self, item: Review):
|
||||
return _("{review_title} - a review of {item_title}").format(
|
||||
s = _("{review_title} - a review of {item_title}").format(
|
||||
review_title=item.title, item_title=item.item.title
|
||||
)
|
||||
if has_spoiler(item.body):
|
||||
s += " (" + _("may contain spoiler or triggering content") + ")"
|
||||
return s
|
||||
|
||||
def item_description(self, item: Review):
|
||||
target_html = (
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue