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 0000000..a6853a7 Binary files /dev/null and b/booker/static/sound/beep.mp3 differ 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 %}