Deletion of place images

This commit is contained in:
reverend 2020-09-26 16:08:56 +02:00
parent e217d3254e
commit 5f33ec5824
2 changed files with 17 additions and 1 deletions

View File

@ -94,9 +94,23 @@
<ul class="LP-ImageGrid__Container">
{% for place_image in place.placeimages.all %}
<li class="LP-ImageGrid__Item">
<a href="{{ place_image.filename.large.url }}" class="LP-Link"><img class="LP-Image" src="{{ place_image.filename.thumbnail.url }}"></a>
<a href="{{ place_image.filename.large.url }}" class="LP-Link">
<img class="LP-Image" src="{{ place_image.filename.thumbnail.url }}">
</a>
{% if user.explorer == place_image.submitted_by or user.explorer == place.submitted_by %}
<span class="LP-ImageGrid__DeleteItem" title="Bild löschen">
<a href="{% url 'place_image_delete' pk=place_image.id %}" class="LP-Link">
<img class="LP-Icon" src="{% static 'icons/cancel.svg' %}" />
</a>
</span>
{% endif %}
</li>
{% endfor %}
<li class="LP-ImageGrid__Item LP-ImageGrid__Item--add" title="Bild hinzufügen">
<a class="LP-Link" href="{% url 'place_image_create' place_id=place.id%}">
<img class="LP-Icon" src="{% static 'icons/plus.svg' %}" />
</a>
</li>
</ul>
</div>
</section>

View File

@ -14,6 +14,7 @@ from lostplaces.views import (
PhotoAlbumCreateView,
PhotoAlbumDeleteView,
PlaceImageCreateView,
PlaceImageDeleteView,
FlatView
)
@ -27,6 +28,7 @@ urlpatterns = [
path('place/delete/<int:pk>/', PlaceDeleteView.as_view(), name='place_delete'),
path('place/', PlaceListView.as_view(), name='place_list'),
path('place_image/create/<int:place_id>', PlaceImageCreateView.as_view(), name='place_image_create'),
path('place_image/delete/<int:pk>', PlaceImageDeleteView.as_view(), name='place_image_delete'),
path('flat/<slug:slug>/', FlatView, name='flatpage'),
# POST-only URLs for tag submission