From 7013301fbd65c0ac8bc57cab74396ab834dba40f Mon Sep 17 00:00:00 2001 From: Dirk Jahnke Date: Thu, 24 Mar 2022 15:54:04 +0100 Subject: [PATCH] Added account login --- container/views.py | 16 ++++++++++++++-- homelog/urls.py | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/container/views.py b/container/views.py index 747b49c..27c5b51 100644 --- a/container/views.py +++ b/container/views.py @@ -1,6 +1,6 @@ from django.views import generic from .models import Container, ContainerType - +from blabel import LabelWriter class ContainerListView(generic.ListView): model = Container @@ -44,6 +44,19 @@ class ContainerDeleteView(generic.DetailView): model = Container +class ContainerPrintLabelView(generic.DetailView): + model = Container + template_name = 'container/container_print_label.html' + + def get(self, **kwargs): + super().get(kwargs) + label_writer = LabelWriter( + 'templates/label/container_label.html', + default_stylesheets=("templates/label/label_style.css",) + ) + label_writer.write_labels(kwargs['pk'], target="container_label.pdf") + + class ContainerTypeListView(generic.ListView): template_name = 'container/container_type_list.html' context_object_name = 'container_type_list' @@ -89,4 +102,3 @@ class ContainerTypeUpdateView(generic.UpdateView): class ContainerTypeDeleteView(generic.DetailView): model = ContainerType - diff --git a/homelog/urls.py b/homelog/urls.py index f40a5df..857b49c 100644 --- a/homelog/urls.py +++ b/homelog/urls.py @@ -17,6 +17,7 @@ from django.contrib import admin from django.urls import include, path from django.views.generic import TemplateView from homelog import views +from django.contrib.auth import views as auth_views urlpatterns = [ ] @@ -28,4 +29,5 @@ urlpatterns = [ path('container/', include('container.urls')), path('asset/', include('asset.urls')), path('admin/', admin.site.urls), + path('accounts/login/', auth_views.LoginView.as_view(), name='account_login'), ]