allow normal user to change item type

This commit is contained in:
Your Name 2023-01-31 21:43:18 -05:00
parent e507a7aeac
commit f76dd03b54
2 changed files with 10 additions and 7 deletions

View file

@ -49,14 +49,12 @@
{% endfor %}
</div>
{% if request.user.is_staff %}
{% if item.class_name == "movie" or item.class_name == "tvshow" %}
<div class="aside-section-wrapper">
<div class="action-panel">
{% if item.class_name == "movie" or item.class_name == "tvshow" %}
<div class="action-panel__label">{% trans '切换分类' %} </div>
<div class="action-panel__button-group">
<form method="post" action="{% url 'catalog:recast' item.url_path item.uuid %}" onsubmit="return confirm('Confirm updating?');">
<form method="post" action="{% url 'catalog:recast' item.url_path item.uuid %}" onsubmit="return confirm('确认切换吗?');">
{% csrf_token %}
{% if item.class_name == "movie" %}
<input type="hidden" value="tvshow" name="class">
@ -68,8 +66,15 @@
{% endif %}
</form>
</div>
{% endif %}
</div>
</div>
{% endif %}
{% if request.user.is_staff %}
<div class="aside-section-wrapper">
<div class="action-panel">
\
<div class="action-panel__label">{% trans '合并到另一条目' %} </div>
<div class="action-panel__button-group">
<form method="post" action="{% url 'catalog:merge' item.url_path item.uuid %}" onsubmit="return confirm('Confirm merging?');">

View file

@ -175,8 +175,6 @@ def delete(request, item_path, item_uuid):
def recast(request, item_path, item_uuid):
if request.method != "POST":
return HttpResponseBadRequest()
if not request.user.is_staff:
raise PermissionDenied()
item = get_object_or_404(Item, uid=base62.decode(item_uuid))
cls = request.POST.get("class")
model = TVShow if cls == "tvshow" else (Movie if cls == "movie" else None)