fix 500 with missing parent item

This commit is contained in:
Your Name 2024-01-22 23:19:04 -05:00 committed by Henri Dickson
parent 8e38d1c4e4
commit 20ab9cb420
5 changed files with 20 additions and 19 deletions

View file

@ -0,0 +1,3 @@
{% extends "_item_card_metadata_base.html" %}
{% load humanize %}
{% load i18n %}

View file

@ -0,0 +1,3 @@
{% extends "_item_card_metadata_base.html" %}
{% load humanize %}
{% load i18n %}

View file

@ -10,13 +10,15 @@
{% load strip_scheme %}
{% load thumb %}
{% block head %}
<meta http-equiv="refresh"
content="0;url={{ item.program.absolute_url }}?focus={{ item.uuid }}{% if request.GET.position %}&position={{ request.GET.position }}{% endif %}" />
{% if item.parent_item %}
<meta http-equiv="refresh"
content="0;url={{ item.parent_item.url }}?focus={{ item.uuid }}{% if request.GET.position %}&position={{ request.GET.position }}{% endif %}" />
{% endif %}
<meta property="og:image"
content="{{ item.cover_url | default:item.program.cover_image_url }}">
<meta property="twitter:image"
content="{{ item.cover_url | default:item.program.cover_image_url }}">
{% if item.media_url %}
{% if item.media_url and item.parent_item %}
<meta property="twitter:card" content="player">
<meta property="twitter:player"
content="{{ item.program.absolute_url }}/embed?focus={{ item.uuid }}{% if request.GET.position %}&position={{ request.GET.position }}{% endif %}" />

View file

@ -10,6 +10,8 @@
{% load strip_scheme %}
{% load thumb %}
{% block head %}
<meta http-equiv="refresh"
content="0;url={{ item.parent_item.url }}?focus={{ item.uuid }}" />
{% if item.parent_item %}
<meta http-equiv="refresh"
content="0;url={{ item.parent_item.url }}?focus={{ item.uuid }}" />
{% endif %}
{% endblock %}

View file

@ -24,19 +24,6 @@
data-position="{{ activity.action_object.metadata.position | default:0 }}"><i class="fa-solid fa-circle-play"></i></a>
</span>
{% endif %}
<!--
<span>
{% if not action.taken %}
<a title="添加标记" hx-get="{% url 'journal:mark' activity.action_object.item.parent_item.uuid %}?shelf_type=wishlist" hx-target="body" hx-swap="beforeend">
<i class="fa-regular fa-bookmark"></i>
</a>
{% else %}
<a title="修改标记" hx-get="{% url 'journal:mark' activity.action_object.item.parent_item.uuid %}" hx-target="body" hx-swap="beforeend">
<i class="fa-solid fa-bookmark"></i>
</a>
{% endif %}
</span>
-->
<span>
<a title="评论节目"
hx-get="{% url 'journal:comment' activity.action_object.item.uuid %}"
@ -61,7 +48,11 @@
{% endif %}
</div>
<article>
{% include "_item_card.html" with item=activity.action_object.item.parent_item allow_embed=1 %}
{% if activity.action_object.item.parent_item %}
{% include "_item_card.html" with item=activity.action_object.item.parent_item allow_embed=1 %}
{% else %}
{% include "_item_card.html" with item=activity.action_object.item %}
{% endif %
<footer>
{% if activity.action_object.mark.comment_text %}<p>{{ activity.action_object.mark.comment_html|safe }}</p>{% endif %}
<p id="replies_{{ activity.action_object.latest_post.pk }}"></p>