minor comic view fix

This commit is contained in:
aneuhmanh 2025-02-20 20:16:06 +02:00
parent dc3925eb73
commit eb0370cf60
2 changed files with 1 additions and 13 deletions

2
app.py
View File

@ -862,7 +862,7 @@ def logout():
@login_required @login_required
def delete(content_type, content_id): def delete(content_type, content_id):
if content_type == 'art': if content_type == 'art':
content = Art.query.get_or_404(content_id) content = Image.query.get_or_404(content_id)
file_path = os.path.join(app.config['UPLOAD_FOLDER']['arts'], content.image_file) file_path = os.path.join(app.config['UPLOAD_FOLDER']['arts'], content.image_file)
elif content_type == 'video': elif content_type == 'video':
content = Video.query.get_or_404(content_id) content = Video.query.get_or_404(content_id)

View File

@ -51,18 +51,6 @@
</div> </div>
{% endif %} {% endif %}
<div class="vote-section">
<p>Votes: {{ content.cookie_votes }} 🍪</p>
{% if current_user.is_authenticated %}
<form action="{{ url_for('vote_' + content_type, **{'image_id' if content_type == 'art' else 'video_id' if content_type == 'video' else 'comic_id': content.id}) }}" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="button">Vote</button>
</form>
{% else %}
<p>You need to <a href="{{ url_for('login') }}">log in</a> to vote.</p>
{% endif %}
</div>
{% if current_user.is_authenticated and current_user.username == content.username %} {% if current_user.is_authenticated and current_user.username == content.username %}
<form method="POST" action="{{ url_for('delete', content_type=content_type, content_id=content.id) }}"> <form method="POST" action="{{ url_for('delete', content_type=content_type, content_id=content.id) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">