diff --git a/container/templates/container/container_delete.html b/container/templates/container/container_delete.html
new file mode 100644
index 0000000..6908a4a
--- /dev/null
+++ b/container/templates/container/container_delete.html
@@ -0,0 +1,32 @@
+{% extends "base.html" %}
+{% load static %}
+
+{% block title %}Delete Container: {{ object.named_id }}{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
Container: {{ container.named_id }}
+
{{ container.description }}
+
Color: {{ container.color }}
+
+
+
+
+
+
+
+
+
+{% endblock content %}
+
diff --git a/container/templates/container/container_detail.html b/container/templates/container/container_detail.html
new file mode 100644
index 0000000..ce3ba4b
--- /dev/null
+++ b/container/templates/container/container_detail.html
@@ -0,0 +1,32 @@
+{% extends "base.html" %}
+{% load static %}
+
+{% block title %}Container: {{ container.named_id }}{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
Container: {{ container.named_id }}
+
{{ container.description }}
+
Color: {{ container.color }}
+
+
+
+
+
+
+
+
+
+{% endblock content %}
+
diff --git a/container/templates/container/container_details.html b/container/templates/container/container_details.html
deleted file mode 100644
index 0b38c24..0000000
--- a/container/templates/container/container_details.html
+++ /dev/null
@@ -1,4 +0,0 @@
-Container: {{ container.named_id }}
-{{ container.description }}
-Color: {{ container.color }}
-
diff --git a/container/templates/container/container_edit.html b/container/templates/container/container_edit.html
new file mode 100644
index 0000000..ecf3a9d
--- /dev/null
+++ b/container/templates/container/container_edit.html
@@ -0,0 +1,32 @@
+{% extends "base.html" %}
+{% load static %}
+
+{% block title %}Edit Container: {{ object.named_id }}{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
Container: {{ container.named_id }}
+
{{ container.description }}
+
Color: {{ container.color }}
+
+
+
+
+
+
+
+
+
+{% endblock content %}
+
diff --git a/container/templates/container/container_index.html b/container/templates/container/container_index.html
new file mode 100644
index 0000000..d61d75a
--- /dev/null
+++ b/container/templates/container/container_index.html
@@ -0,0 +1,33 @@
+{% extends "base.html" %}
+{% load static %}
+
+{% block title %}Container: {{ container.named_id }}{% endblock %}
+
+{% block content %}
+
+
New Container:
+ {% if container_list %}
+
+ {% else %}
+
No container are available.
+ {% endif %}
+
+
+ {% if container_type_list %}
+
New Container Types:
+
+
+ {% else %}
+ No container types are available.
+ {% endif %}
+
+{% endblock content %}
+
diff --git a/container/templates/container/container_type_detail.html b/container/templates/container/container_type_detail.html
new file mode 100644
index 0000000..81c4021
--- /dev/null
+++ b/container/templates/container/container_type_detail.html
@@ -0,0 +1,47 @@
+{% extends "base.html" %}
+{% load static %}
+
+{% block title %}Container Type: {{ container_type.named_id }}{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
Container Type: {{ container_type.named_id }}
+
{{ container_type.description }}
+
+
+
+
+
+
Size:
{{ container_type.width }}mm x {{ container_type.length }}mm x {{ container_type.height }}mm
+
Inner Size:
+ {% if container_type.inner_width and container_type.inner_length and container_type.inner_height %}
+ {{ container_type.inner_width }}mm x {{ container_type.inner_length }}mm x {{ container_type.inner_height }}mm
+ {% endif %}
+
+
+
+
Has Cover:
{% if container_type.has_cover %} yes {% else %} no {% endif %}
+
Can hold Containers:
{% if container_type.contains_container %} yes {% else %} no {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+{% endblock content %}
+
diff --git a/container/templates/container/container_type_details.html b/container/templates/container/container_type_details.html
deleted file mode 100644
index 0ca9326..0000000
--- a/container/templates/container/container_type_details.html
+++ /dev/null
@@ -1,8 +0,0 @@
-Container: {{ container_type.named_id }}
-{{ container_type.description }}
-
-Width: | {{ container_type.width }} mm | Inner Width: | {{ container_type.inner_width }} mm |
-Length: | {{ container_type.length }} mm | Inner Length: | {{ container_type.inner_length }} mm |
-Height: | {{ container_type.height }} mm | Inner Height: | {{ container_type.inner_height }} mm |
-Has Cover: | {% if container_type.has_cover %} yes {% else %} no {% endif %} | Can hold Containers: | {% if container_type.contains_container %} yes {% else %} no {% endif %} |
-
diff --git a/container/templates/container/container_type_index.html b/container/templates/container/container_type_index.html
new file mode 100644
index 0000000..acfde6d
--- /dev/null
+++ b/container/templates/container/container_type_index.html
@@ -0,0 +1,21 @@
+{% extends "base.html" %}
+{% load static %}
+
+{% block title %}Container: {{ container.named_id }}{% endblock %}
+
+{% block content %}
+
+ {% if container_type_list %}
+
New Container Types:
+
+
+ {% else %}
+ No container types are available.
+ {% endif %}
+
+{% endblock content %}
+
diff --git a/container/templates/container/index.html b/container/templates/container/index.html
deleted file mode 100644
index f398ceb..0000000
--- a/container/templates/container/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
New Container:
-{% if container_list %}
-
-{% else %}
-
No container are available.
-{% endif %}
-
-
-
New Container Types:
-{% if container_type_list %}
-
-{% else %}
-
No container types are available.
-{% endif %}
-
diff --git a/container/urls.py b/container/urls.py
index 7821b28..b4917ca 100644
--- a/container/urls.py
+++ b/container/urls.py
@@ -4,9 +4,11 @@ from . import views
app_name = 'container'
urlpatterns = [
- path('', views.index, name='index'),
- path('/', views.container_details, name='container_details'),
- path('type//', views.container_type_details, name='container_type_details'),
- # path('type//', views.container_type_details, name='container_type_details'),
+ path('', views.IndexView.as_view(), name='index'),
+ path('/', views.DetailView.as_view(), name='detail'),
+ path('edit//', views.EditView.as_view(), name='edit'),
+ path('delete//', views.DeleteView.as_view(), name='delete'),
+ path('type/', views.TypeIndexView.as_view(), name='container_type_index'),
+ path('type//', views.TypeDetailView.as_view(), name='container_type_detail'),
]
diff --git a/container/views.py b/container/views.py
index 070f6c3..3b9016f 100644
--- a/container/views.py
+++ b/container/views.py
@@ -2,27 +2,39 @@ from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from django.http import Http404
+from django.urls import reverse
+from django.views import generic
from .models import Container, ContainerType
-def index(request):
- container_list = Container.objects.order_by('-created_ts')[:5]
- container_type_list = ContainerType.objects.order_by('-created_ts')[:5]
- ctx = {'container_list': container_list, 'container_type_list': container_type_list}
- return render(request, 'container/index.html', ctx)
+class IndexView(generic.ListView):
+ template_name = 'container/container_index.html'
+ context_object_name = 'container_list'
-def container_type_details(request, container_type_id):
- try:
- ctype = ContainerType.objects.get(pk=container_type_id)
- except ContainerType.DoesNotExist:
- raise Http404("Container Type does not exist")
- return render(request, 'container/container_type_details.html', {'container_type': ctype})
+ def get_queryset(self):
+ # Return the last five created containers
+ return Container.objects.order_by('-created_ts')[:5]
-def container_details(request, container_id):
- try:
- container = Container.objects.get(pk=container_id)
- except Container.DoesNotExist:
- raise Http404("Container does not exist")
- return render(request, 'container/container_details.html', {'container': container})
+class TypeIndexView(generic.ListView):
+ template_name = 'container/container_type_index.html'
+ context_object_name = 'container_type_list'
+ def get_queryset(self):
+ # Return the last five created container types
+ return ContainerType.objects.order_by('-created_ts')[:5]
+
+class DetailView(generic.DetailView):
+ model = Container
+ # template_name = 'container/detail.html'
+
+class TypeDetailView(generic.DetailView):
+ model = ContainerType
+ context_object_name = 'container_type'
+ template_name = 'container/container_type_detail.html'
+
+class EditView(generic.DetailView):
+ model = Container
+
+class DeleteView(generic.DetailView):
+ model = Container
diff --git a/homelog/settings.py b/homelog/settings.py
index 10309b1..368dc60 100644
--- a/homelog/settings.py
+++ b/homelog/settings.py
@@ -55,7 +55,7 @@ ROOT_URLCONF = 'homelog.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [],
+ 'DIRS': [ BASE_DIR / 'homelog/templates' ],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
diff --git a/homelog/templates/base.html b/homelog/templates/base.html
new file mode 100644
index 0000000..e3c1f40
--- /dev/null
+++ b/homelog/templates/base.html
@@ -0,0 +1,113 @@
+{% load static i18n %}
+{% get_current_language as LANGUAGE_CODE %}
+
+
+
+
+ {% block title %}homelog{% endblock title %}
+
+
+
+
+
+
+ {% block css %}
+
+
+
+
+
+
+ {% endblock %}
+
+ {# Placed at the top of the document so pages load faster with defer #}
+ {% block javascript %}
+
+
+
+
+
+
+
+ {% endblock javascript %}
+
+
+
+
+
+
+
+
+
+ {% if messages %}
+ {% for message in messages %}
+
+ {{ message }}
+
+
+ {% endfor %}
+ {% endif %}
+
+ {% block content %}
+
Use this document as a way to quick start any new project.
+ {% endblock content %}
+
+
+
+ {% block modal %}{% endblock modal %}
+
+ {% block inline_javascript %}
+ {% comment %}
+ Script tags with only code, no src (defer by default). To run
+ with a "defer" so that you run inline code:
+
+ {% endcomment %}
+ {% endblock inline_javascript %}
+
+
diff --git a/homelog/templates/homelog/about.html b/homelog/templates/homelog/about.html
new file mode 100644
index 0000000..3fe0a17
--- /dev/null
+++ b/homelog/templates/homelog/about.html
@@ -0,0 +1,8 @@
+{% extends "base.html" %}
+{% load static %}
+
+{% block content %}
+
+This is ABOUT
+
+{% endblock %}
diff --git a/homelog/templates/homelog/home.html b/homelog/templates/homelog/home.html
new file mode 100644
index 0000000..31a7027
--- /dev/null
+++ b/homelog/templates/homelog/home.html
@@ -0,0 +1,11 @@
+{% extends "base.html" %}
+{% load static %}
+
+{% block content %}
+
+This is HOME
+Container Types
+Container
+
+
+{% endblock %}
diff --git a/homelog/urls.py b/homelog/urls.py
index 8950837..7b5904e 100644
--- a/homelog/urls.py
+++ b/homelog/urls.py
@@ -15,8 +15,16 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import include, path
+from django.views.generic import TemplateView
+from homelog import views
urlpatterns = [
+]
+
+urlpatterns = [
+ path('', TemplateView.as_view(template_name="homelog/home.html"), name='index'),
+ path('home/', TemplateView.as_view(template_name="homelog/home.html"), name='home'),
+ path('about/', TemplateView.as_view(template_name="homelog/about.html"), name='about'),
path('container/', include('container.urls')),
path('admin/', admin.site.urls),
]
diff --git a/homelog/views.py b/homelog/views.py
new file mode 100644
index 0000000..354c6c6
--- /dev/null
+++ b/homelog/views.py
@@ -0,0 +1,14 @@
+from django.shortcuts import render
+from django.http import HttpResponse
+from django.template import loader
+from django.http import Http404
+
+
+"""
+def home(request):
+ return render(request, 'homelog/home.html')
+
+def about(request):
+ return render(request, 'homelog/about.html')
+"""
+
diff --git a/static/css/project.css b/static/css/project.css
new file mode 100644
index 0000000..f1d543d
--- /dev/null
+++ b/static/css/project.css
@@ -0,0 +1,13 @@
+/* These styles are generated from project.scss. */
+
+.alert-debug {
+ color: black;
+ background-color: white;
+ border-color: #d6e9c6;
+}
+
+.alert-error {
+ color: #b94a48;
+ background-color: #f2dede;
+ border-color: #eed3d7;
+}
diff --git a/static/fonts/.gitkeep b/static/fonts/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/static/images/favicons/favicon.ico b/static/images/favicons/favicon.ico
new file mode 100644
index 0000000..e1c1dd1
Binary files /dev/null and b/static/images/favicons/favicon.ico differ
diff --git a/static/js/project.js b/static/js/project.js
new file mode 100644
index 0000000..d26d23b
--- /dev/null
+++ b/static/js/project.js
@@ -0,0 +1 @@
+/* Project specific Javascript goes here. */
diff --git a/static/sass/custom_bootstrap_vars.scss b/static/sass/custom_bootstrap_vars.scss
new file mode 100644
index 0000000..e69de29
diff --git a/static/sass/project.scss b/static/sass/project.scss
new file mode 100644
index 0000000..3c8f261
--- /dev/null
+++ b/static/sass/project.scss
@@ -0,0 +1,37 @@
+
+
+
+
+// project specific CSS goes here
+
+////////////////////////////////
+ //Variables//
+////////////////////////////////
+
+// Alert colors
+
+$white: #fff;
+$mint-green: #d6e9c6;
+$black: #000;
+$pink: #f2dede;
+$dark-pink: #eed3d7;
+$red: #b94a48;
+
+////////////////////////////////
+ //Alerts//
+////////////////////////////////
+
+// bootstrap alert CSS, translated to the django-standard levels of
+// debug, info, success, warning, error
+
+.alert-debug {
+ background-color: $white;
+ border-color: $mint-green;
+ color: $black;
+}
+
+.alert-error {
+ background-color: $pink;
+ border-color: $dark-pink;
+ color: $red;
+}