feat: add list view ofall images
This commit is contained in:
parent
dae5381b58
commit
e34ab98456
16
idescriptor/templates/idescriptor/list_images.html
Normal file
16
idescriptor/templates/idescriptor/list_images.html
Normal 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 %}
|
@ -5,4 +5,5 @@ from . import views
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", views.index, name="index"),
|
path("", views.index, name="index"),
|
||||||
path("image/<uuid:pk>/", views.ImageFormView.as_view(), name="image-update"),
|
path("image/<uuid:pk>/", views.ImageFormView.as_view(), name="image-update"),
|
||||||
|
path("images/", views.list_images, name="images-list"),
|
||||||
]
|
]
|
@ -12,6 +12,10 @@ def get_image_for_descriptor():
|
|||||||
image = Image.objects.filter(Q(alt_text=None) | Q(title=None)).first()
|
image = Image.objects.filter(Q(alt_text=None) | Q(title=None)).first()
|
||||||
return image
|
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):
|
class ImageFormView(UpdateView):
|
||||||
model = Image
|
model = Image
|
||||||
|
Loading…
Reference in New Issue
Block a user