fix performance language

This commit is contained in:
Your Name 2023-06-05 02:46:26 -04:00 committed by Henri Dickson
parent e5641c7d5f
commit 7d7ece13ac
10 changed files with 22 additions and 22 deletions

View file

@ -221,7 +221,7 @@ class BaseSchema(Schema):
api_url: str
category: ItemCategory
parent_uuid: str | None
full_title: str
display_title: str
external_resources: list[ExternalResourceSchema] | None
@ -360,7 +360,7 @@ class Item(SoftDeleteMixin, PolymorphicModel):
return self.__class__.__name__.lower()
@property
def full_title(self):
def display_title(self):
return self.title
@classmethod

View file

@ -225,7 +225,7 @@ class PerformanceProduction(Item):
return self.show
@property
def full_title(self):
def display_title(self):
return f"{self.show.title} {self.title}"
@property

View file

@ -90,7 +90,7 @@ class PodcastEpisode(Item):
return self.program
@property
def full_title(self):
def display_title(self):
return f"{self.program.title} - {self.title}"
@property

View file

@ -21,7 +21,7 @@ class SearchResultItem:
}
self.source_site = source_site
self.source_url = source_url
self.title = title
self.display_title = title
self.subtitle = subtitle
self.brief = brief
self.cover_image_url = cover_url

View file

@ -5,9 +5,9 @@
<h5>
<a href="{{ item.url }}">
{% if request.GET.q %}
{{ item.full_title | highlight:request.GET.q }}
{{ item.display_title | highlight:request.GET.q }}
{% else %}
{{ item.full_title }}
{{ item.display_title }}
{% endif %}
</a>
<small>
@ -50,9 +50,11 @@
</span>
{% endif %}
{% if item.release_date %}<span>{{ item.release_date }}</span>{% endif %}
{% include '_people.html' with people=item.genre role='' max=10 %}
{% if item.language %}<span>{{ item.language }}</span>{% endif %}
{% include '_people.html' with people=item.platform role='' max=10 %}
{% include '_people.html' with people=item.genre role='' max=2 %}
{% include '_people.html' with people=item.troupe role='' max=2 %}
{% include '_people.html' with people=item.location role='' max=2 %}
{% include '_people.html' with people=item.language role='' max=5 %}
{% include '_people.html' with people=item.platform role='' max=5 %}
{% if item.show %}
<span>{{ item.show.type.label }}<a href="{{ item.show.url }}">{{ item.show.title }}</a></span>
{% endif %}

View file

@ -16,14 +16,14 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:title"
content="{{ site_name }}{% trans item.category.label %} - {{ item.full_title }}">
content="{{ site_name }}{% trans item.category.label %} - {{ item.display_title }}">
<meta property="og:type" content="{{ item.category }}">
<meta property="og:url" content="{{ request.build_absolute_uri }}">
{% if item.has_cover %}<meta property="og:image" content="{{ item.cover_image_url }}">{% endif %}
<meta property="og:site_name" content="{{ site_name }}">
<meta property="og:description" content="{{ item.brief }}">
{% if item.is_deleted or item.merged_to_item %}<meta name="robots" content="noindex">{% endif %}
<title>{{ site_name }} - {% trans item.category.label %} | {{ item.full_title }}</title>
<title>{{ site_name }} - {% trans item.category.label %} | {{ item.display_title }}</title>
{% include "common_libs.html" with jquery=0 v2=1 %}
{% block head %}{% endblock %}
</head>
@ -36,7 +36,7 @@
[MERGED TO <a href="{{ item.merged_to_item.url }}">{{ item.merged_to_item.title }}</a>]
{% endif %}
<h1>
{{ item.full_title }}
{{ item.display_title }}
<small>
{% if item.year %}({{ item.year }}){% endif %}
</small>

View file

@ -15,9 +15,7 @@
<div>{% include '_people.html' with people=item.genre role='类型' max=5 %}</div>
<div>{% include '_people.html' with people=item.troupe role='剧团' max=5 %}</div>
<div>{% include '_people.html' with people=item.location role='剧院' max=5 %}</div>
<div>
{% if item.language %}语言: <span>{{ item.language }}</span>{% endif %}
</div>
<div>{% include '_people.html' with people=item.language role='语言' max=5 %}</div>
<div>
{% if item.opening_date %}日期: <span>{{ item.opening_date }}</span>{% endif %}
</div>
@ -49,7 +47,7 @@
{% if prod.opening_date %}上演日期:{{ prod.opening_date }}{% endif %}
</div>
{% include '_people.html' with people=prod.location _role='上演剧院' max=2 %}
{% if prod.language %}语言:{{ prod.language }}{% endif %}
{% include '_people.html' with people=prod.language _role='语言' max=5 %}
</div>
<div class="tldr-2">
{% include '_people.html' with people=prod.director role='导演' max=2 %}

View file

@ -321,7 +321,7 @@ class TVSeason(Item):
return [(i.value, i.label) for i in id_types]
@property
def full_title(self):
def display_title(self):
if self.season_number and not re.match(r"^.+第.+季$", self.title):
return f"{self.title}{self.season_number}" # TODO i18n
else:

View file

@ -241,7 +241,7 @@ def comment(request, item_uuid, focus_item_uuid):
shared_link = comment.metadata.get("shared_link") if comment else None
status_id = get_status_id_by_url(shared_link)
link = focus_item.get_absolute_url_with_position(position or None)
status = f"分享{ItemCategory(item.category).label}{focus_item.full_title}\n{link}\n\n{text}"
status = f"分享{ItemCategory(item.category).label}{focus_item.display_title}\n{link}\n\n{text}"
spoiler, status = get_spoiler_text(status, item)
try:
response = post_toot(

View file

@ -406,7 +406,7 @@ def get_status_id_by_url(url):
def get_spoiler_text(text, item):
if text.find(">!") != -1:
spoiler_text = f"关于《{item.full_title}》 可能有关键情节等敏感内容"
spoiler_text = f"关于《{item.display_title}》 可能有关键情节等敏感内容"
return spoiler_text, text.replace(">!", "").replace("!<", "")
else:
return None, text
@ -447,7 +447,7 @@ def share_mark(mark):
mark.rating_grade,
MastodonApplication.objects.get(domain_name=user.mastodon_site).star_mode,
)
content = f"{mark.action_label}{mark.item.full_title}{stars}\n{mark.item.absolute_url}\n{mark.comment_text or ''}{tags}"
content = f"{mark.action_label}{mark.item.display_title}{stars}\n{mark.item.absolute_url}\n{mark.comment_text or ''}{tags}"
update_id = get_status_id_by_url(mark.shared_link)
spoiler_text, content = get_spoiler_text(content, mark.item)
response = post_toot(
@ -495,7 +495,7 @@ def share_review(review):
if user.get_preference().mastodon_append_tag
else ""
)
content = f"发布了关于《{review.item.full_title}》的评论\n{review.title}\n{review.absolute_url}{tags}"
content = f"发布了关于《{review.item.display_title}》的评论\n{review.title}\n{review.absolute_url}{tags}"
update_id = None
if review.metadata.get(
"shared_link"