diff --git a/catalog/performance/models.py b/catalog/performance/models.py index d231774b..7d8be4b0 100644 --- a/catalog/performance/models.py +++ b/catalog/performance/models.py @@ -360,7 +360,6 @@ class PerformanceProduction(Item): return self.show def set_parent_item(self, value): - print("set", value) self.show = value @property diff --git a/catalog/templates/_sidebar_edit.html b/catalog/templates/_sidebar_edit.html index 9426bc04..7b52a354 100644 --- a/catalog/templates/_sidebar_edit.html +++ b/catalog/templates/_sidebar_edit.html @@ -13,14 +13,18 @@ {% trans '源网站' %}: {{ res.site_name.label }}
-
+ {% csrf_token %} - +
{% if request.user.is_staff %} -
+ {% csrf_token %} @@ -77,8 +81,27 @@ {% elif item.journal_exist and not request.user.is_staff %} ⛔️ 条目已被用户标记过 {% else %} + {% if item.class_name == "tvseason" or item.class_name == "performanceproduction" %} + {% if not item.show or request.user.is_superuser %} +
+ 将{{ item.type.label }}关联到上一级条目 + + {% csrf_token %} + +
+ + +
+ {% endif %} + {% endif %}
- {% trans '合并到另一条目' %} + {% trans '合并到同类另一条目' %} {% if item.journal_exist %}🚸 条目已被用户标记过{% endif %}

- +
{% for i in item.merged_from_items.all %} {% if forloop.first %} @@ -116,7 +139,7 @@ + value="{% trans '删除' %}"> {% endif %}
diff --git a/catalog/templates/catalog_edit.html b/catalog/templates/catalog_edit.html index 1600d872..3f816959 100644 --- a/catalog/templates/catalog_edit.html +++ b/catalog/templates/catalog_edit.html @@ -48,7 +48,9 @@ {% if not item or item.editable or request.user.is_staff %} {% endif %} - +
diff --git a/catalog/views.py b/catalog/views.py index ee7fe3bc..a88335d4 100644 --- a/catalog/views.py +++ b/catalog/views.py @@ -291,7 +291,8 @@ def assign_parent(request, item_path, item_uuid): if not request.user.is_staff and item.parent_item: raise BadRequest("Already assigned to a parent item") _logger.warn(f"{request.user} assign {item} to {parent_item}") - item.set_parent_item(parent_item, save=True) + item.set_parent_item(parent_item) + item.save() return redirect(item.url)