feat: add list view ofall images

This commit is contained in:
moanos [he/him] 2024-10-21 20:43:30 +02:00
parent dae5381b58
commit e34ab98456
3 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,16 @@
{% extends "idescriptor/base_generic.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block title %}<title>{% translate "Organize images for a bot" %}</title>{% endblock %}
{% block content %}
<div class="card">
<ul>
{% for image in images %}
<li><a href="{{ image.get_absolute_url }}">{{ image }}</a></li>
{% endfor %}
</ul>
</div>
{% endblock %}

View File

@ -5,4 +5,5 @@ from . import views
urlpatterns = [
path("", views.index, name="index"),
path("image/<uuid:pk>/", views.ImageFormView.as_view(), name="image-update"),
path("images/", views.list_images, name="images-list"),
]

View File

@ -12,6 +12,10 @@ def get_image_for_descriptor():
image = Image.objects.filter(Q(alt_text=None) | Q(title=None)).first()
return image
def list_images(request):
images = Image.objects.all()
context = {"images": images}
return render(request, 'idescriptor/list_images.html', context=context)
class ImageFormView(UpdateView):
model = Image