diff --git a/container/templates/container/container_type_list.html b/container/templates/container/container_type_list.html index acfde6d..fcc7d87 100644 --- a/container/templates/container/container_type_list.html +++ b/container/templates/container/container_type_list.html @@ -1,21 +1,75 @@ {% extends "base.html" %} {% load static %} -{% block title %}Container: {{ container.named_id }}{% endblock %} +{% block title %}Container Type List{% endblock %} {% block content %}
{% if container_type_list %} -
New Container Types:
- -
+ + + + + + + + + + + + + + + {% for ctype in container_type_list %} + + + + + + + + + + + {% endfor %} + +
Container TypeDescriptionSize (mm)Inner Size (mm)Coverholds ContainerChangedAction
{{ ctype.named_id }}
{{ ctype.description }}
{% if ctype.width %}{{ ctype.width }}x{{ ctype.length }}x{{ ctype.height }}{% endif %}
{% if ctype.inner_width %}{{ ctype.inner_width }}x{{ ctype.inner_length }}x{{ ctype.inner_height }}{% endif %}
{% if ctype.has_cover %}yes{%else %}--{% endif %}
{% if ctype.contains_container %}yes{%else %}--{% endif %}
{{ ctype.changed_ts | date:'H:i:s d.m.Y' }}
Delete
+ {% else %}

No container types are available.

{% endif %} + +
+ +
+ +
+ + Container Type + + Container + + Asset +
+ +
+ + {% endblock content %} diff --git a/container/urls.py b/container/urls.py index 7e84868..ef56232 100644 --- a/container/urls.py +++ b/container/urls.py @@ -1,7 +1,8 @@ from django.urls import path from container.views import ContainerListView, ContainerUpdateView, ContainerCreateView, ContainerDetailView, ContainerDeleteView -from container.views import ContainerTypeListView, ContainerTypeDetailView, ContainerTypeCreateView +from container.views import ContainerTypeListView, ContainerTypeDetailView, ContainerTypeCreateView, ContainerTypeUpdateView, ContainerTypeDeleteView + app_name = 'container' urlpatterns = [ path('', ContainerListView.as_view(), name='list'), @@ -11,5 +12,7 @@ urlpatterns = [ path('type/', ContainerTypeListView.as_view(), name='container_type_list'), path('type//', ContainerTypeDetailView.as_view(), name='container_type_detail'), path('type/add/', ContainerTypeCreateView.as_view(), name='container_type_add'), + path('type/edit//', ContainerTypeUpdateView.as_view(), name='container_type_update'), + path('type/delete//', ContainerTypeDeleteView.as_view(), name='container_type_delete'), ] diff --git a/container/views.py b/container/views.py index 0913786..747b49c 100644 --- a/container/views.py +++ b/container/views.py @@ -73,3 +73,20 @@ class ContainerTypeCreateView(generic.CreateView): form.instance.changed_by = self.request.user form.instance.created_by = self.request.user return super().form_valid(form) + + +class ContainerTypeUpdateView(generic.UpdateView): + model = ContainerType + # template_name = 'container/detail.html' + fields = ['named_id', 'description', 'width', 'length', 'height', 'inner_width', 'inner_length', 'inner_height', + 'has_cover', 'contains_container'] + + def form_valid(self, form): + form.instance.changed_by = self.request.user + return super().form_valid(form) + + +class ContainerTypeDeleteView(generic.DetailView): + model = ContainerType + +