Delete things implemented (can't believe I forgot that...)
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 14s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 3s
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 14s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 3s
This commit is contained in:
@@ -21,4 +21,4 @@ data:
|
|||||||
LOGOUT_REDIRECT_URL: "/login/"
|
LOGOUT_REDIRECT_URL: "/login/"
|
||||||
OIDC_AUTHENTICATION_FAILURE_REDIRECT_URL: "/login/"
|
OIDC_AUTHENTICATION_FAILURE_REDIRECT_URL: "/login/"
|
||||||
GUNICORN_OPTS: "--access-logfile -"
|
GUNICORN_OPTS: "--access-logfile -"
|
||||||
IMAGE_TAG: "0.078"
|
IMAGE_TAG: "0.079"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ spec:
|
|||||||
mountPath: /data
|
mountPath: /data
|
||||||
containers:
|
containers:
|
||||||
- name: web
|
- name: web
|
||||||
image: git.baumann.gr/adebaumann/labhelper:0.078
|
image: git.baumann.gr/adebaumann/labhelper:0.079
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
|
|||||||
@@ -284,6 +284,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="section">
|
||||||
|
<form method="post" action="{% url 'delete_thing' thing.id %}"
|
||||||
|
onsubmit="return confirm('Are you sure you want to delete {{ thing.name }}? This cannot be undone.');">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" class="btn btn-danger">
|
||||||
|
<i class="fas fa-trash"></i> Delete Thing
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extra_css %}
|
{% block extra_css %}
|
||||||
|
|||||||
@@ -373,6 +373,21 @@ def delete_box(request, box_id):
|
|||||||
return redirect('box_management')
|
return redirect('box_management')
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def delete_thing(request, thing_id):
|
||||||
|
"""Delete a thing and its associated files."""
|
||||||
|
thing = get_object_or_404(Thing, pk=thing_id)
|
||||||
|
if request.method == 'POST':
|
||||||
|
box_id = thing.box.id
|
||||||
|
if thing.picture:
|
||||||
|
thing.picture.delete(save=False)
|
||||||
|
for thing_file in thing.files.all():
|
||||||
|
thing_file.file.delete(save=False)
|
||||||
|
thing.delete()
|
||||||
|
return redirect('box_detail', box_id=box_id)
|
||||||
|
return redirect('edit_thing', thing_id=thing_id)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def resources_list(request):
|
def resources_list(request):
|
||||||
"""List all links and files from things that have them."""
|
"""List all links and files from things that have them."""
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ from boxes.views import (
|
|||||||
boxes_list,
|
boxes_list,
|
||||||
delete_box,
|
delete_box,
|
||||||
delete_box_type,
|
delete_box_type,
|
||||||
|
delete_thing,
|
||||||
edit_box,
|
edit_box,
|
||||||
edit_box_type,
|
edit_box_type,
|
||||||
edit_thing,
|
edit_thing,
|
||||||
@@ -53,6 +54,7 @@ urlpatterns = [
|
|||||||
path('box/<str:box_id>/', box_detail, name='box_detail'),
|
path('box/<str:box_id>/', box_detail, name='box_detail'),
|
||||||
path('thing/<int:thing_id>/', thing_detail, name='thing_detail'),
|
path('thing/<int:thing_id>/', thing_detail, name='thing_detail'),
|
||||||
path('thing/<int:thing_id>/edit/', edit_thing, name='edit_thing'),
|
path('thing/<int:thing_id>/edit/', edit_thing, name='edit_thing'),
|
||||||
|
path('thing/<int:thing_id>/delete/', delete_thing, name='delete_thing'),
|
||||||
path('box/<str:box_id>/add/', add_things, name='add_things'),
|
path('box/<str:box_id>/add/', add_things, name='add_things'),
|
||||||
path('boxes/', boxes_list, name='boxes_list'),
|
path('boxes/', boxes_list, name='boxes_list'),
|
||||||
path('inventory/', boxes_list, name='inventory'),
|
path('inventory/', boxes_list, name='inventory'),
|
||||||
|
|||||||
Reference in New Issue
Block a user