From 0b285b068caa7a46ff8ccbc887b14f69da716e1c Mon Sep 17 00:00:00 2001 From: Dirk Jahnke Date: Tue, 24 May 2022 17:53:31 +0200 Subject: [PATCH] Added smartphone as scanner option --- .gitignore | 4 + booker/static/sound/beep.mp3 | Bin 0 -> 9244 bytes booker/templates/booker/index.html | 4 + .../templates/booker/smartphone_scanner.html | 234 ++++++++++++++++++ booker/urls.py | 1 + booker/views.py | 5 +- homelog/settings.py | 15 +- homelog/templates/base.html | 4 + 8 files changed, 263 insertions(+), 4 deletions(-) create mode 100644 booker/static/sound/beep.mp3 create mode 100644 booker/templates/booker/smartphone_scanner.html diff --git a/.gitignore b/.gitignore index 0dd8805..8d20ee8 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,7 @@ venv.bak/ !.vscode/launch.json !.vscode/extensions.json .history +node_modules/ +deploy/ +media/ + diff --git a/booker/static/sound/beep.mp3 b/booker/static/sound/beep.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..a6853a7d99d049ce172e500abcc4203c05c8a713 GIT binary patch literal 9244 zcmeI0XHXPfx3(JwktiTY4uj+lQ zB65aad{(@KENlrW3}lZNbB@1`{n2YfEpf9q1ct|QSG@=OO^BQphyVpy!?>w#;Mm)^ z;a6d?7r^tin0!D1xPe2U_zI_poE|6n`5N{&cJW;hj>6%R3eFplJ*fAbn1NW2T~kpS z@F9tPiv8cnB`HEPON*?*6DcFs6!ghSr15b8@H0FT`rBxw`tUDG0n2SxB$B71B_=v6TLyN$HReLJCR?G2`?1D<#H*v5M&{cSKU#0DbS&?QwC+ zccs@+s=IcDMm%=3+O^k&9ASJrEVelx$#HjT4%(ZFaPI}jW{X9VcdcL^;zyW9AZmPU zcxg>J^8(W(S}h9vgCC6TOgc@vtBd%SPc@$q;nIg13E~uGcC;D))Tfv=R(S@{)0l04 zS$|P7Ds~XDo7witjlKBFKJkW9bQ0fxniljQf3ev0=Ar2jLn{Up zM^(@N%dJV#AUPUT1!4?U{J}a2nOdnHtivvkQWSei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b3k#U^yDeK3e@7cnin|Ja^@*++%1+< zbl$*dbCu)HZ@*sgl$>){dSqNZJRY_M;Peu>!EnV?AR@^r3fe6~ry(B#1K5>u6@$hS z2_fx8lAz`ok4;i;5(R@OtTJ;J{{?SJt<&TSYuqP zL)nD~ldGe6)_0Qhs&21S9UWLe6oCwS-IDo8vGk30$8;`JONNSB7HD{YL+^@HL9m=} z8dU+|Tw3j83a^0l&bu>*-1z~e>{cNh$4L@p!E9Tx-2xj3T$CFPRhiQ(pSDO#-D^TU z0PXyu?bsEea~Th*s~&QPB&KsY7))XSZaf7TDAFvNvBl;t$t1-)wKqi{!L9+zi)kE? zgtttKehtQ@dh69y!^1-a?lowVWp9;I>MG~F*bY46V~hxqdGJD35iEe>>L0es@;=xt z%Z<=lRLSptIc&Y;JRxh6{pxhT&+r08C-Xn+5l`N;3 zzKu~;u=E|dp;i5f;e!QxXp2~mt&peI(J=gN{#$u)??UD`-Jgw&RAm(VOC}bffvR4) zlSAhrx$)gkrCDl-(OpF=;jHC!|S@JhmX(iHVAg zao_x2)Il9m;srxCY~L!h4dwS-Vs1QeKQM030`iw^n_J?$clt2*7u;eLFchroZ#)Ek zd)rHY_0DcLfz}d4TCIQE*!y+J#rl!tNvHpw20hGagZfaXX)KF~zUi2GZ&{o9`#Pzu zb$`i9|GSc6?=Fnj+7#CP)dmix^n$g`2R(>RL-U++D=L>;ZJP?P-AI8YLlL7-_HQg7V6L%bN4_n&=; zk#5oQn$V1l8*80xM;V9nul2ou=hLp{{LwH68i66{h2R+3H=%0|9#cJg#Nu(e@6M2(4X=B-&g%h=-+$wXOw>l i{Tbi?ebv8&{=HY%O7Q>r_5UUGf4_{s75|$9!2bXyJFr{; literal 0 HcmV?d00001 diff --git a/booker/templates/booker/index.html b/booker/templates/booker/index.html index 4e6271c..e99ca10 100644 --- a/booker/templates/booker/index.html +++ b/booker/templates/booker/index.html @@ -54,5 +54,9 @@ +
+

Use your smartphone

+

Use your smartphone to scan.

+
{% endblock %} diff --git a/booker/templates/booker/smartphone_scanner.html b/booker/templates/booker/smartphone_scanner.html new file mode 100644 index 0000000..f57d80c --- /dev/null +++ b/booker/templates/booker/smartphone_scanner.html @@ -0,0 +1,234 @@ +{% extends "base.html" %} +{% load static %} + +{% block additional_css %} + + +{% endblock %} + +{% block title %}Smartphone Scanner{% endblock %} + +{% block content %} +
+ +
+ Start + Reset +
+
+
+ +
+ + + +
+ +
+
+
+ +
+ + + + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+ + +
+
+ + + +{% endblock %} diff --git a/booker/urls.py b/booker/urls.py index d8b2746..af2da1e 100644 --- a/booker/urls.py +++ b/booker/urls.py @@ -5,5 +5,6 @@ app_name = 'booker' urlpatterns = [ path('', views.IndexView.as_view(), name='index'), + path('smartphone_scanner/', views.SmartphoneScannerView.as_view(), name='smartphone_scanner'), path('/', views.scanner, name='scanner') ] diff --git a/booker/views.py b/booker/views.py index 5ec69bf..d6128f7 100644 --- a/booker/views.py +++ b/booker/views.py @@ -1,5 +1,5 @@ from django.shortcuts import render -from django.views.generic import ListView +from django.views.generic import ListView, TemplateView from .models import Scanner @@ -12,3 +12,6 @@ def scanner(request, scanner_id): return render(request, 'booker/scanner.html', { 'scanner_id': scanner_id }) + +class SmartphoneScannerView(TemplateView): + template_name = 'booker/smartphone_scanner.html' diff --git a/homelog/settings.py b/homelog/settings.py index 4075935..82e47ba 100644 --- a/homelog/settings.py +++ b/homelog/settings.py @@ -61,7 +61,7 @@ ROOT_URLCONF = 'homelog.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [ BASE_DIR / 'homelog/templates' ], + 'DIRS': [BASE_DIR / 'homelog/templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -79,7 +79,7 @@ ASGI_APPLICATION = 'homelog.asgi.application' CHANNEL_LAYERS = { 'default': { - #'BACKEND': 'channels.layers.InMemoryChannelLayer', + # 'BACKEND': 'channels.layers.InMemoryChannelLayer', "BACKEND": "channels_redis.core.RedisChannelLayer", "CONFIG": { "hosts": [("speicher2.fritz.box", 6379)], @@ -138,6 +138,12 @@ STATIC_URL = '/static/' STATICFILES_DIRS = [ BASE_DIR / "static" ] +STATIC_ROOT = os.path.join(BASE_DIR, "deploy/static/") +STATICFILES_FINDERS = [ + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', + 'npm.finders.NpmFinder' +] # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field @@ -177,5 +183,8 @@ REST_FRAMEWORK = { ], 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', 'PAGE_SIZE': 10, - 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'] + 'DEFAULT_RENDERER_CLASSES': [ + 'rest_framework.renderers.JSONRenderer', + 'rest_framework.renderers.BrowsableAPIRenderer', + ] } diff --git a/homelog/templates/base.html b/homelog/templates/base.html index e7c2271..81bea06 100644 --- a/homelog/templates/base.html +++ b/homelog/templates/base.html @@ -19,6 +19,8 @@ {% endblock %} + {% block additional_css %} + {% endblock %} {# Placed at the top of the document so pages load faster with defer #} @@ -31,6 +33,8 @@ {% endblock javascript %} + {% block additional_javascript %} + {% endblock %}