Improve uploading/downloading files

This commit is contained in:
Joakim Hellsén 2024-03-17 19:39:22 +01:00
commit 7005490bf4
No known key found for this signature in database
GPG key ID: D196AE66FEBE1DC9
18 changed files with 4596 additions and 134 deletions

View file

@ -13,4 +13,38 @@
</li>
{% endfor %}
</ul>
<h3>Uploads</h3>
{% if user_uploads %}
<p>Uploaded files:</p>
{% else %}
<p>No uploaded files yet.</p>
{% endif %}
<ul id="uploads-list">
{% for upload in user_uploads %}
<li id="upload-{{ upload.id }}">
<a href="{{ upload.get_absolute_url }}">{{ upload }}</a>
<p>
Description: <span id="description-{{ upload.id }}">{{ upload.description|default:"No description" }}</span>
{% if upload.notes %}
<br>
Notes: {{ upload.notes }}
{% endif %}
</p>
<form method="post" action="{% url 'delete_upload' %}">
{% csrf_token %}
<input type="hidden" name="file_id" value="{{ upload.id }}">
<button type="submit">Delete</button>
</form>
<form method="post"
hx-post="{% url 'edit_description' %}"
hx-target="#description-{{ upload.id }}"
hx-swap="innerHTML">
{% csrf_token %}
<input type="hidden" name="file_id" value="{{ upload.id }}">
<input type="text" name="description" placeholder="New description" required>
<button type="submit">Edit description</button>
</form>
</li>
{% endfor %}
</ul>
{% endblock %}