diff --git a/catalog/common/models.py b/catalog/common/models.py index d130e446..03d223a3 100644 --- a/catalog/common/models.py +++ b/catalog/common/models.py @@ -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 diff --git a/catalog/performance/models.py b/catalog/performance/models.py index 2cabfca7..d8486389 100644 --- a/catalog/performance/models.py +++ b/catalog/performance/models.py @@ -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 diff --git a/catalog/podcast/models.py b/catalog/podcast/models.py index eb5300c0..48da2aaf 100644 --- a/catalog/podcast/models.py +++ b/catalog/podcast/models.py @@ -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 diff --git a/catalog/search/external.py b/catalog/search/external.py index 2c55d0d8..c89eea29 100644 --- a/catalog/search/external.py +++ b/catalog/search/external.py @@ -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 diff --git a/catalog/templates/_item_card_metadata.html b/catalog/templates/_item_card_metadata.html index c8ef5523..c9bdad7d 100644 --- a/catalog/templates/_item_card_metadata.html +++ b/catalog/templates/_item_card_metadata.html @@ -5,9 +5,9 @@
{% 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 %} @@ -50,9 +50,11 @@ {% endif %} {% if item.release_date %}{{ item.release_date }}{% endif %} - {% include '_people.html' with people=item.genre role='' max=10 %} - {% if item.language %}{{ item.language }}{% 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 %} {{ item.show.type.label }}:{{ item.show.title }} {% endif %} diff --git a/catalog/templates/item_base.html b/catalog/templates/item_base.html index dfcc5def..72b53282 100644 --- a/catalog/templates/item_base.html +++ b/catalog/templates/item_base.html @@ -16,14 +16,14 @@ + content="{{ site_name }}{% trans item.category.label %} - {{ item.display_title }}"> {% if item.has_cover %}{% endif %} {% if item.is_deleted or item.merged_to_item %}{% endif %} - {{ site_name }} - {% trans item.category.label %} | {{ item.full_title }} + {{ site_name }} - {% trans item.category.label %} | {{ item.display_title }} {% include "common_libs.html" with jquery=0 v2=1 %} {% block head %}{% endblock %} @@ -36,7 +36,7 @@ [MERGED TO {{ item.merged_to_item.title }}] {% endif %}

- {{ item.full_title }} + {{ item.display_title }} {% if item.year %}({{ item.year }}){% endif %} diff --git a/catalog/templates/performance.html b/catalog/templates/performance.html index 93549eac..af974053 100644 --- a/catalog/templates/performance.html +++ b/catalog/templates/performance.html @@ -15,9 +15,7 @@
{% include '_people.html' with people=item.genre role='类型' max=5 %}
{% include '_people.html' with people=item.troupe role='剧团' max=5 %}
{% include '_people.html' with people=item.location role='剧院' max=5 %}
-
- {% if item.language %}语言: {{ item.language }}{% endif %} -
+
{% include '_people.html' with people=item.language role='语言' max=5 %}
{% if item.opening_date %}日期: {{ item.opening_date }}{% endif %}
@@ -49,7 +47,7 @@ {% if prod.opening_date %}上演日期:{{ prod.opening_date }}{% endif %} {% 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 %}
{% include '_people.html' with people=prod.director role='导演' max=2 %} diff --git a/catalog/tv/models.py b/catalog/tv/models.py index 0e4b8927..594d5646 100644 --- a/catalog/tv/models.py +++ b/catalog/tv/models.py @@ -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: diff --git a/journal/views.py b/journal/views.py index f7e867e5..abe41dae 100644 --- a/journal/views.py +++ b/journal/views.py @@ -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( diff --git a/mastodon/api.py b/mastodon/api.py index 10765272..4010efd3 100644 --- a/mastodon/api.py +++ b/mastodon/api.py @@ -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"