Added account login

This commit is contained in:
Dirk Jahnke 2022-03-24 15:54:04 +01:00
parent 63f4ef1f1a
commit 7013301fbd
2 changed files with 16 additions and 2 deletions

View File

@ -1,6 +1,6 @@
from django.views import generic from django.views import generic
from .models import Container, ContainerType from .models import Container, ContainerType
from blabel import LabelWriter
class ContainerListView(generic.ListView): class ContainerListView(generic.ListView):
model = Container model = Container
@ -44,6 +44,19 @@ class ContainerDeleteView(generic.DetailView):
model = Container 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): class ContainerTypeListView(generic.ListView):
template_name = 'container/container_type_list.html' template_name = 'container/container_type_list.html'
context_object_name = 'container_type_list' context_object_name = 'container_type_list'
@ -89,4 +102,3 @@ class ContainerTypeUpdateView(generic.UpdateView):
class ContainerTypeDeleteView(generic.DetailView): class ContainerTypeDeleteView(generic.DetailView):
model = ContainerType model = ContainerType

View File

@ -17,6 +17,7 @@ from django.contrib import admin
from django.urls import include, path from django.urls import include, path
from django.views.generic import TemplateView from django.views.generic import TemplateView
from homelog import views from homelog import views
from django.contrib.auth import views as auth_views
urlpatterns = [ urlpatterns = [
] ]
@ -28,4 +29,5 @@ urlpatterns = [
path('container/', include('container.urls')), path('container/', include('container.urls')),
path('asset/', include('asset.urls')), path('asset/', include('asset.urls')),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('accounts/login/', auth_views.LoginView.as_view(), name='account_login'),
] ]