diff --git a/.gitignore b/.gitignore index 47893ce..b4fce52 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ build/ */__pycache__/ */*/__pycache__/ caromserver/local_settings.py +/staticfiles/ diff --git a/billard/admin.py b/billard/admin.py index 98e7484..b06774c 100644 --- a/billard/admin.py +++ b/billard/admin.py @@ -1,11 +1,10 @@ +from django import forms from django.conf.urls import url from django.contrib import admin, messages +from django.core.exceptions import ValidationError from django.shortcuts import redirect -from django.template.response import TemplateResponse from .models import * -from django import forms -from django.core.exceptions import ValidationError class LocationAdminForm(forms.ModelForm): @@ -26,13 +25,14 @@ class LocationAdminForm(forms.ModelForm): class LocationAdmin(admin.ModelAdmin): form = LocationAdminForm list_display = ('code', 'name', 'city', 'happy_hour_start', 'happy_hour_end') - fields = ['users', 'code', 'happy_hour_start', 'happy_hour_end', 'name', 'street', 'plz', 'city', 'phone', 'email', 'url', ] + fields = ['users', 'code', 'happy_hour_start', 'happy_hour_end', 'name', 'street', 'plz', 'city', 'phone', 'email', + 'url', ] @admin.register(Client) class ClientAdmin(admin.ModelAdmin): - list_display = ('uuid', 'location', 'report_user') - fields = ['location', 'uuid', 'report_user'] + list_display = ('uuid', 'location', 'report_user', 'last_seen') + fields = ['location', 'uuid', 'report_user', 'last_seen'] @admin.register(LocationData) @@ -40,13 +40,15 @@ class LocationDataAdmin(admin.ModelAdmin): def get_urls(self): urls = super().get_urls() my_urls = [ - url(r'^process_locationdata/$', self.admin_site.admin_view(self.process_locationdata), name='process_locationdata'), + url(r'^process_locationdata/$', self.admin_site.admin_view(self.process_locationdata), + name='process_locationdata'), ] return my_urls + urls def process_locationdata(self, request): messages.success(request, 'Items processed.') return redirect('admin:billard_locationdata_changelist') + list_display = ('client_id', 'desk_no', 'tst', 'on_off', 'processed', 'error_msg') fields = ['client_id', 'desk_no', 'tst', 'on_off', 'processed', 'error_msg'] diff --git a/billard/migrations/0001_initial.py b/billard/migrations/0001_initial.py index 6a2e816..83e828a 100644 --- a/billard/migrations/0001_initial.py +++ b/billard/migrations/0001_initial.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/billard/migrations/0002_location.py b/billard/migrations/0002_location.py index 8969661..e708efc 100644 --- a/billard/migrations/0002_location.py +++ b/billard/migrations/0002_location.py @@ -7,7 +7,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('billard', '0001_initial'), diff --git a/billard/migrations/0003_client.py b/billard/migrations/0003_client.py index 4023293..b570d95 100644 --- a/billard/migrations/0003_client.py +++ b/billard/migrations/0003_client.py @@ -2,13 +2,13 @@ # Generated by Django 1.10.5 on 2017-02-04 05:48 from __future__ import unicode_literals -from django.db import migrations, models -import django.db.models.deletion import uuid +import django.db.models.deletion +from django.db import migrations, models + class Migration(migrations.Migration): - dependencies = [ ('billard', '0002_location'), ] diff --git a/billard/migrations/0004_accounting.py b/billard/migrations/0004_accounting.py index 050183c..fe6bd33 100644 --- a/billard/migrations/0004_accounting.py +++ b/billard/migrations/0004_accounting.py @@ -2,12 +2,11 @@ # Generated by Django 1.10.5 on 2017-02-04 10:17 from __future__ import unicode_literals -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0003_client'), ] diff --git a/billard/migrations/0005_auto_20170206_1926.py b/billard/migrations/0005_auto_20170206_1926.py index 232d6a0..e9520ef 100644 --- a/billard/migrations/0005_auto_20170206_1926.py +++ b/billard/migrations/0005_auto_20170206_1926.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0004_accounting'), ] diff --git a/billard/migrations/0006_auto_20170206_2031.py b/billard/migrations/0006_auto_20170206_2031.py index b5b188e..0220610 100644 --- a/billard/migrations/0006_auto_20170206_2031.py +++ b/billard/migrations/0006_auto_20170206_2031.py @@ -2,14 +2,14 @@ # Generated by Django 1.10.5 on 2017-02-06 19:31 from __future__ import unicode_literals +import uuid + +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion -import uuid class Migration(migrations.Migration): - dependencies = [ ('billard', '0005_auto_20170206_1926'), ] @@ -17,7 +17,8 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( name='accounting', - options={'ordering': ['-time_from'], 'verbose_name': 'Buchhaltungseintrag', 'verbose_name_plural': 'Buchhaltungseinträge'}, + options={'ordering': ['-time_from'], 'verbose_name': 'Buchhaltungseintrag', + 'verbose_name_plural': 'Buchhaltungseinträge'}, ), migrations.AlterModelOptions( name='client', @@ -34,7 +35,8 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='accounting', name='client', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Client', verbose_name='Client'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Client', + verbose_name='Client'), ), migrations.AlterField( model_name='accounting', @@ -59,7 +61,8 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='client', name='location', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Location', verbose_name='Standort'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Location', + verbose_name='Standort'), ), migrations.AlterField( model_name='client', @@ -109,7 +112,8 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='location', name='users', - field=models.ManyToManyField(related_name='locations', to=settings.AUTH_USER_MODEL, verbose_name='Benutzer'), + field=models.ManyToManyField(related_name='locations', to=settings.AUTH_USER_MODEL, + verbose_name='Benutzer'), ), migrations.AlterField( model_name='locationdata', diff --git a/billard/migrations/0007_desk.py b/billard/migrations/0007_desk.py index 4de137c..a6bc4c2 100644 --- a/billard/migrations/0007_desk.py +++ b/billard/migrations/0007_desk.py @@ -2,12 +2,11 @@ # Generated by Django 1.10.5 on 2017-02-10 18:30 from __future__ import unicode_literals -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0006_auto_20170206_2031'), ] @@ -20,9 +19,12 @@ class Migration(migrations.Migration): ('desk_no', models.IntegerField(verbose_name='Tischnummer')), ('name', models.CharField(blank=True, max_length=32, null=True, verbose_name='Tischbezeichnung')), ('enabled', models.BooleanField(verbose_name='Tisch aktiv')), - ('prize', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, verbose_name='Normelpreis')), - ('prize_hh', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, verbose_name='Preis Happy Hour')), - ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Client', verbose_name='Client')), + ('prize', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, + verbose_name='Normelpreis')), + ('prize_hh', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, + verbose_name='Preis Happy Hour')), + ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Client', + verbose_name='Client')), ], options={ 'verbose_name_plural': 'Tische', diff --git a/billard/migrations/0008_auto_20170210_1947.py b/billard/migrations/0008_auto_20170210_1947.py index b661151..7fe1499 100644 --- a/billard/migrations/0008_auto_20170210_1947.py +++ b/billard/migrations/0008_auto_20170210_1947.py @@ -2,12 +2,11 @@ # Generated by Django 1.10.5 on 2017-02-10 19:47 from __future__ import unicode_literals -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0007_desk'), ] @@ -48,6 +47,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='desk', name='client', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='desks', to='billard.Client', verbose_name='Client'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='desks', + to='billard.Client', verbose_name='Client'), ), ] diff --git a/billard/migrations/0009_auto_20170210_1955.py b/billard/migrations/0009_auto_20170210_1955.py index 4bfb974..38d598e 100644 --- a/billard/migrations/0009_auto_20170210_1955.py +++ b/billard/migrations/0009_auto_20170210_1955.py @@ -6,7 +6,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('billard', '0008_auto_20170210_1947'), ] diff --git a/billard/migrations/0010_auto_20170210_2040.py b/billard/migrations/0010_auto_20170210_2040.py index f577c7e..1700255 100644 --- a/billard/migrations/0010_auto_20170210_2040.py +++ b/billard/migrations/0010_auto_20170210_2040.py @@ -6,7 +6,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('billard', '0009_auto_20170210_1955'), ] diff --git a/billard/migrations/0011_auto_20170210_2122.py b/billard/migrations/0011_auto_20170210_2122.py index 419c8f9..e679ecf 100644 --- a/billard/migrations/0011_auto_20170210_2122.py +++ b/billard/migrations/0011_auto_20170210_2122.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0010_auto_20170210_2040'), ] diff --git a/billard/migrations/0012_auto_20170211_1003.py b/billard/migrations/0012_auto_20170211_1003.py index d6873d4..50340f2 100644 --- a/billard/migrations/0012_auto_20170211_1003.py +++ b/billard/migrations/0012_auto_20170211_1003.py @@ -6,7 +6,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('billard', '0011_auto_20170210_2122'), ] diff --git a/billard/migrations/0013_accounting.py b/billard/migrations/0013_accounting.py index 1dcc17a..86f3877 100644 --- a/billard/migrations/0013_accounting.py +++ b/billard/migrations/0013_accounting.py @@ -2,12 +2,11 @@ # Generated by Django 1.10.5 on 2017-02-11 09:03 from __future__ import unicode_literals -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0012_auto_20170211_1003'), ] @@ -19,9 +18,11 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('time_from', models.DateTimeField(verbose_name='Beginn')), ('time_to', models.DateTimeField(blank=True, null=True, verbose_name='Ende')), - ('prize', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, verbose_name='Preis')), + ('prize', + models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, verbose_name='Preis')), ('billed', models.BooleanField(default=False, verbose_name='Abgerechnet')), - ('desk', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Desk', verbose_name='Tisch')), + ('desk', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Desk', + verbose_name='Tisch')), ], options={ 'verbose_name_plural': 'Buchhaltungseinträge', diff --git a/billard/migrations/0014_auto_20170211_2008.py b/billard/migrations/0014_auto_20170211_2008.py index e4d4d98..13d2b28 100644 --- a/billard/migrations/0014_auto_20170211_2008.py +++ b/billard/migrations/0014_auto_20170211_2008.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0013_accounting'), ] diff --git a/billard/migrations/0015_auto_20170222_1023.py b/billard/migrations/0015_auto_20170222_1023.py index c3b7ed6..03b0bff 100644 --- a/billard/migrations/0015_auto_20170222_1023.py +++ b/billard/migrations/0015_auto_20170222_1023.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0014_auto_20170211_2008'), ] diff --git a/billard/migrations/0016_auto_20170225_1822.py b/billard/migrations/0016_auto_20170225_1822.py index 635e96d..3792a32 100644 --- a/billard/migrations/0016_auto_20170225_1822.py +++ b/billard/migrations/0016_auto_20170225_1822.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0015_auto_20170222_1023'), ] diff --git a/billard/migrations/0017_accounting_reporter_uuid.py b/billard/migrations/0017_accounting_reporter_uuid.py index e4c09fa..96a844e 100644 --- a/billard/migrations/0017_accounting_reporter_uuid.py +++ b/billard/migrations/0017_accounting_reporter_uuid.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0016_auto_20170225_1822'), ] diff --git a/billard/migrations/0017_auto_20170302_1610.py b/billard/migrations/0017_auto_20170302_1610.py index cd03e68..cbe7acd 100644 --- a/billard/migrations/0017_auto_20170302_1610.py +++ b/billard/migrations/0017_auto_20170302_1610.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0016_auto_20170225_1822'), ] diff --git a/billard/migrations/0018_auto_20170302_2058.py b/billard/migrations/0018_auto_20170302_2058.py index ba2c4a7..ac816c4 100644 --- a/billard/migrations/0018_auto_20170302_2058.py +++ b/billard/migrations/0018_auto_20170302_2058.py @@ -2,13 +2,12 @@ # Generated by Django 1.10.5 on 2017-03-02 20:58 from __future__ import unicode_literals +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('billard', '0017_accounting_reporter_uuid'), @@ -18,16 +17,20 @@ class Migration(migrations.Migration): migrations.AddField( model_name='accounting', name='prize_hh', - field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, verbose_name='Preis Happy Hour'), + field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, + verbose_name='Preis Happy Hour'), ), migrations.AddField( model_name='accounting', name='prize_normal', - field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, verbose_name='Preis Normalzeit'), + field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, + verbose_name='Preis Normalzeit'), ), migrations.AddField( model_name='client', name='report_user', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='reporting_clients', to=settings.AUTH_USER_MODEL, verbose_name='Reporting Benutzer'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, + related_name='reporting_clients', to=settings.AUTH_USER_MODEL, + verbose_name='Reporting Benutzer'), ), ] diff --git a/billard/migrations/0019_merge_20170310_1941.py b/billard/migrations/0019_merge_20170310_1941.py index 46a2a3f..f4e8840 100644 --- a/billard/migrations/0019_merge_20170310_1941.py +++ b/billard/migrations/0019_merge_20170310_1941.py @@ -6,7 +6,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('billard', '0018_auto_20170302_2058'), ('billard', '0017_auto_20170302_1610'), diff --git a/billard/migrations/0020_auto_20170410_1853.py b/billard/migrations/0020_auto_20170410_1853.py index 989784c..db0c031 100644 --- a/billard/migrations/0020_auto_20170410_1853.py +++ b/billard/migrations/0020_auto_20170410_1853.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from django.db import migrations + def create_default_groups_permissions(apps, schema_editor): # We can't import the Person model directly as it may be a newer # version than this migration expects. We use the historical version. @@ -16,6 +17,7 @@ def create_default_groups_permissions(apps, schema_editor): ag.save() ag.permissions.add(Permission.objects.get(codename="change_accounting")) + def delete_default_groups_permissions(apps, schema_editor): Group = apps.get_model("auth", "Group") Group.objects.get(name='Location').delete() @@ -23,7 +25,6 @@ def delete_default_groups_permissions(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('billard', '0019_merge_20170310_1941'), ('sessions', '0001_initial'), diff --git a/billard/migrations/0021_accounting_account_user.py b/billard/migrations/0021_accounting_account_user.py index a36ff21..2cf0b98 100644 --- a/billard/migrations/0021_accounting_account_user.py +++ b/billard/migrations/0021_accounting_account_user.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0020_auto_20170410_1853'), ] diff --git a/billard/migrations/0022_auto_20170427_0835.py b/billard/migrations/0022_auto_20170427_0835.py index 96e686e..44a52a2 100644 --- a/billard/migrations/0022_auto_20170427_0835.py +++ b/billard/migrations/0022_auto_20170427_0835.py @@ -2,12 +2,11 @@ # Generated by Django 1.11 on 2017-04-27 08:35 from __future__ import unicode_literals -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0021_accounting_account_user'), ] @@ -16,6 +15,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='client', name='location', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='clients', to='billard.Location', verbose_name='Standort'), + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='clients', + to='billard.Location', verbose_name='Standort'), ), ] diff --git a/billard/migrations/0023_accounting_account_tst.py b/billard/migrations/0023_accounting_account_tst.py index 7fe5c71..ee1f791 100644 --- a/billard/migrations/0023_accounting_account_tst.py +++ b/billard/migrations/0023_accounting_account_tst.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('billard', '0022_auto_20170427_0835'), ] diff --git a/billard/migrations/0024_auto_20180210_1105.py b/billard/migrations/0024_auto_20180210_1105.py index aaef85d..6e42ea6 100644 --- a/billard/migrations/0024_auto_20180210_1105.py +++ b/billard/migrations/0024_auto_20180210_1105.py @@ -1,12 +1,11 @@ # Generated by Django 2.0.2 on 2018-02-10 11:05 +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ('billard', '0023_accounting_account_tst'), ] @@ -15,21 +14,26 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='accounting', name='desk', - field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='billard.Desk', verbose_name='Tisch'), + field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='billard.Desk', + verbose_name='Tisch'), ), migrations.AlterField( model_name='client', name='location', - field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='clients', to='billard.Location', verbose_name='Standort'), + field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='clients', + to='billard.Location', verbose_name='Standort'), ), migrations.AlterField( model_name='client', name='report_user', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='reporting_clients', to=settings.AUTH_USER_MODEL, verbose_name='Reporting Benutzer'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, + related_name='reporting_clients', to=settings.AUTH_USER_MODEL, + verbose_name='Reporting Benutzer'), ), migrations.AlterField( model_name='desk', name='client', - field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='desks', to='billard.Client', verbose_name='Client'), + field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='desks', + to='billard.Client', verbose_name='Client'), ), ] diff --git a/billard/migrations/0025_auto_20180211_1059.py b/billard/migrations/0025_auto_20180211_1059.py new file mode 100644 index 0000000..9f2a0c6 --- /dev/null +++ b/billard/migrations/0025_auto_20180211_1059.py @@ -0,0 +1,31 @@ +# Generated by Django 2.0.2 on 2018-02-11 10:59 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('billard', '0024_auto_20180210_1105'), + ] + + operations = [ + migrations.AlterField( + model_name='accounting', + name='desk', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Desk', + verbose_name='Tisch'), + ), + migrations.AlterField( + model_name='client', + name='location', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='clients', + to='billard.Location', verbose_name='Standort'), + ), + migrations.AlterField( + model_name='desk', + name='client', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='desks', + to='billard.Client', verbose_name='Client'), + ), + ] diff --git a/billard/migrations/0026_client_last_seen.py b/billard/migrations/0026_client_last_seen.py new file mode 100644 index 0000000..d716f52 --- /dev/null +++ b/billard/migrations/0026_client_last_seen.py @@ -0,0 +1,17 @@ +# Generated by Django 2.0.2 on 2018-02-11 11:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('billard', '0025_auto_20180211_1059'), + ] + + operations = [ + migrations.AddField( + model_name='client', + name='last_seen', + field=models.DateTimeField(blank=True, null=True, verbose_name='Letzter Update'), + ), + ] diff --git a/billard/models.py b/billard/models.py index 05a6e5e..5ce0cde 100644 --- a/billard/models.py +++ b/billard/models.py @@ -1,8 +1,9 @@ -import uuid import logging +import uuid + +from django.contrib.auth.models import User +from django.contrib.auth.models import User from django.db import models -from django.contrib.auth.models import User -from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver @@ -48,8 +49,10 @@ class Location(models.Model): class Client(models.Model): uuid = models.UUIDField(unique=True, default=uuid.uuid4, verbose_name="Identifier") - location = models.ForeignKey(Location, related_name="clients", verbose_name="Standort", on_delete=models.DO_NOTHING) - report_user = models.ForeignKey(User, blank=True, null=True, verbose_name="Reporting Benutzer", related_name='reporting_clients', on_delete=models.DO_NOTHING) + location = models.ForeignKey(Location, related_name="clients", verbose_name="Standort", on_delete=models.CASCADE) + report_user = models.ForeignKey(User, blank=True, null=True, verbose_name="Reporting Benutzer", + related_name='reporting_clients', on_delete=models.DO_NOTHING) + last_seen = models.DateTimeField(blank=True, null=True, verbose_name="Letzter Update") def __str__(self): return '{}, {}'.format(self.location.name, self.uuid) @@ -60,7 +63,7 @@ class Client(models.Model): class Desk(models.Model): - client = models.ForeignKey(Client, verbose_name='Client', related_name='desks', on_delete=models.DO_NOTHING) + client = models.ForeignKey(Client, verbose_name='Client', related_name='desks', on_delete=models.CASCADE) desk_no = models.IntegerField(verbose_name='Tischnummer') name = models.CharField(max_length=32, blank=True, null=True, verbose_name='Tischbezeichnung') enabled = models.BooleanField(verbose_name='Tisch aktiv') @@ -77,14 +80,16 @@ class Desk(models.Model): class Accounting(models.Model): - desk = models.ForeignKey(Desk, verbose_name="Tisch", on_delete=models.DO_NOTHING) + desk = models.ForeignKey(Desk, verbose_name="Tisch", on_delete=models.CASCADE) time_from = models.DateTimeField(verbose_name="Beginn") time_to = models.DateTimeField(blank=True, null=True, verbose_name="Ende") prize = models.DecimalField(max_digits=6, decimal_places=2, blank=True, null=True, verbose_name="Preis") billed = models.BooleanField(default=False, verbose_name="Abgerechnet") reporter_uuid = models.UUIDField(blank=True, null=True, verbose_name='Reporter UUID') - prize_normal = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, verbose_name="Preis Normalzeit") - prize_hh = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, verbose_name="Preis Happy Hour") + prize_normal = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, + verbose_name="Preis Normalzeit") + prize_hh = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, + verbose_name="Preis Happy Hour") account_user = models.CharField(blank=True, null=True, max_length=128, verbose_name="Abr. Benutzer") account_tst = models.DateTimeField(blank=True, null=True, verbose_name="Abr. TST") diff --git a/billard/serializers.py b/billard/serializers.py index fcf57e7..dd40344 100644 --- a/billard/serializers.py +++ b/billard/serializers.py @@ -1,8 +1,15 @@ -from billard.models import LocationData from rest_framework import serializers +from billard.models import LocationData, Client + class LocationDataSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = LocationData fields = ('client_id', 'desk_no', 'tst', 'on_off',) + + +class ClientUpdateLastSeenSerializer(serializers.HyperlinkedModelSerializer): + class Meta: + model = Client + fields = ('uuid', 'last_seen') diff --git a/billard/tasks.py b/billard/tasks.py index 5fc22dd..98cd688 100644 --- a/billard/tasks.py +++ b/billard/tasks.py @@ -1,8 +1,8 @@ from __future__ import absolute_import, unicode_literals import logging -import billard.utils as utils +import billard.utils as utils from billard.models import LocationData, Client, Accounting log = logging.getLogger(__name__) @@ -58,7 +58,8 @@ def process_location_data(): ld.delete() else: ld.processed = True - ld.error_msg = 'No existing accountings found. Stopp processing! {}, {}'.format(ld.client_id, ld.desk_no) + ld.error_msg = 'No existing accountings found. Stopp processing! {}, {}'.format(ld.client_id, + ld.desk_no) ld.save() log.error(ld.error_msg) except: diff --git a/billard/templates/admin/billard/locationdata/change_list.html b/billard/templates/admin/billard/locationdata/change_list.html index 746f56d..eb84b2f 100644 --- a/billard/templates/admin/billard/locationdata/change_list.html +++ b/billard/templates/admin/billard/locationdata/change_list.html @@ -1,10 +1,10 @@ {% extends "admin/change_list.html" %} {% load i18n admin_urls static admin_list %} {% block object-tools-items %} -
  • - - LD Verarbeiten - -
  • -{{ block.super }} +
  • + + LD Verarbeiten + +
  • + {{ block.super }} {% endblock %} \ No newline at end of file diff --git a/billard/templates/billard/accounting.html b/billard/templates/billard/accounting.html index ff8e3c7..078d7e9 100644 --- a/billard/templates/billard/accounting.html +++ b/billard/templates/billard/accounting.html @@ -4,9 +4,9 @@ {% block title %}Abrechnung{% endblock %} {% block breadcrumb %} - - - + + + {% endblock %} {% block content %} @@ -23,19 +23,19 @@ Preis Happy Hour: Preis gesamt: -{% for acc in accounting %} - - {{ acc.time_from }} - {{ acc.time_to }} - {{ acc.prize_normal }} - {{ acc.prize_hh }} - {{ acc.prize }} - -{% endfor %} + {% for acc in accounting %} + + {{ acc.time_from }} + {{ acc.time_to }} + {{ acc.prize_normal }} + {{ acc.prize_hh }} + {{ acc.prize }} + + {% endfor %}
    -{% csrf_token %} + {% csrf_token %} diff --git a/billard/templates/billard/accountmodal.html b/billard/templates/billard/accountmodal.html index 9ccd870..bf1636c 100644 --- a/billard/templates/billard/accountmodal.html +++ b/billard/templates/billard/accountmodal.html @@ -1,36 +1,37 @@ {% if accounts %} - + {% endif %} \ No newline at end of file diff --git a/billard/templates/billard/index.html b/billard/templates/billard/index.html index 03f02e3..6217bbc 100644 --- a/billard/templates/billard/index.html +++ b/billard/templates/billard/index.html @@ -4,24 +4,25 @@ {% block title %}Location Data{% endblock %} {% block content %} -{% if not locations|length_is:"1" %} - -{% csrf_token %} -
    - -
    -
    -{% endif %} + {% if not locations|length_is:"1" %} +
    + {% csrf_token %} +
    + +
    +
    + {% endif %}
    -{% include 'billard/index_ajax.html' %} + {% include 'billard/index_ajax.html' %}
    @@ -29,20 +30,20 @@ {% block js %} + {% endblock %} diff --git a/billard/templates/billard/index_ajax.html b/billard/templates/billard/index_ajax.html index 10d7261..fe4de39 100644 --- a/billard/templates/billard/index_ajax.html +++ b/billard/templates/billard/index_ajax.html @@ -1,10 +1,10 @@ {% load display_client %} {% if clients %} -{% for cli in clients %} -{% for i in range %} {{ cli|display_client:i }} {% endfor %} -{% endfor %} + {% for cli in clients %} + {% for i in range %} {{ cli|display_client:i }} {% endfor %} + {% endfor %} {% else %} -
    -
    Keine Tische angelegt!
    -
    +
    +
    Keine Tische angelegt!
    +
    {% endif %} \ No newline at end of file diff --git a/billard/templates/billard/location_detail.html b/billard/templates/billard/location_detail.html index 60d3c14..1574d26 100644 --- a/billard/templates/billard/location_detail.html +++ b/billard/templates/billard/location_detail.html @@ -11,6 +11,14 @@
    {% include 'billard/location_detail_ajax.html' %}
    +
    +
    + {% if perms.billard.change_accounting %} + Abrechnen + {% endif %} +
    +
    {% endblock %} diff --git a/billard/templates/billard/location_detail_ajax.html b/billard/templates/billard/location_detail_ajax.html index 8273d0d..603e0a2 100644 --- a/billard/templates/billard/location_detail_ajax.html +++ b/billard/templates/billard/location_detail_ajax.html @@ -1,12 +1,12 @@ {% load display_client %} {% if location.clients.all %} -{% for cli in location.clients.all %} -{% for i in "12345678" %} - {{ cli|display_client:i }} -{% endfor %} -{% endfor %} + {% for cli in location.clients.all %} + {% for i in "12345678" %} + {{ cli|display_client:i }} + {% endfor %} + {% endfor %} {% else %} -
    -
    Keine Tische angelegt!
    -
    +
    +
    Keine Tische angelegt!
    +
    {% endif %} diff --git a/billard/templates/billard/location_index.html b/billard/templates/billard/location_index.html index dc021e6..3627284 100644 --- a/billard/templates/billard/location_index.html +++ b/billard/templates/billard/location_index.html @@ -3,39 +3,41 @@ {% block title %}Standortliste{% endblock %} {% block breadcrumb %} - + {% endblock %} {% block content %} -{% if location_list %} -

    Bitte Standort auswählen:

    - - - - - - - -{% if perms.billard.change_accounting %} - -{% endif %} - -{% for loc in location_list %} - - - - - - -{% if perms.billard.change_accounting %} - -{% endif %} - -{% endfor %} -
    CodeNameStrassePlzOrtAccounting
    {{ loc.code|default_if_none:"" }}{{ loc.name|default_if_none:"" }}{{ loc.street|default_if_none:"" }}{{ loc.plz|default_if_none:"" }}{{ loc.city|default_if_none:"" }}Abrechnen
    -{% else %} -

    Keine Standorte Zugeordnet.

    -{% endif %} + {% if location_list %} +

    Bitte Standort auswählen:

    + + + + + + + + {% if perms.billard.change_accounting %} + + {% endif %} + + {% for loc in location_list %} + + + + + + + {% if perms.billard.change_accounting %} + + {% endif %} + + {% endfor %} +
    CodeNameStrassePlzOrtAccounting
    {{ loc.code|default_if_none:"" }}{{ loc.name|default_if_none:"" }}{{ loc.street|default_if_none:"" }}{{ loc.plz|default_if_none:"" }}{{ loc.city|default_if_none:"" }}Abrechnen
    + {% else %} +

    Keine Standorte Zugeordnet.

    + {% endif %} {% endblock %} diff --git a/billard/templates/billard/locationdata_detail.html b/billard/templates/billard/locationdata_detail.html index 747b125..e95f514 100644 --- a/billard/templates/billard/locationdata_detail.html +++ b/billard/templates/billard/locationdata_detail.html @@ -3,13 +3,15 @@ {% block title %}Location Data{% endblock %} {% block content %} - {% include 'billard/locationdata_detail_ajax.html' %} + {% include 'billard/locationdata_detail_ajax.html' %} {% endblock %} {% block js %} + $(document).ready(function () { + setInterval(function () { + $("#content").load("#") + }, 1000); + }); + {% endblock %} \ No newline at end of file diff --git a/billard/templates/billard/locationdata_list.html b/billard/templates/billard/locationdata_list.html index 8183324..2fda6b6 100644 --- a/billard/templates/billard/locationdata_list.html +++ b/billard/templates/billard/locationdata_list.html @@ -3,13 +3,15 @@ {% block title %}Location Data{% endblock %} {% block content %} -{% include 'billard/locationdata_list_ajax.html' %} + {% include 'billard/locationdata_list_ajax.html' %} {% endblock %} {% block js %} + $(document).ready(function () { + setInterval(function () { + $("#content").load("#") + }, 1000); + }); + {% endblock %} \ No newline at end of file diff --git a/billard/templates/billard/locationdata_list_ajax.html b/billard/templates/billard/locationdata_list_ajax.html index 5925950..96934d7 100644 --- a/billard/templates/billard/locationdata_list_ajax.html +++ b/billard/templates/billard/locationdata_list_ajax.html @@ -10,33 +10,33 @@ -{% if object_list %} -

    Location Data

    - - - - - - - - - - - {% for location_data in object_list %} - - - - - - - - - - {% endfor %} -
    IDLocationTableTimestampOn_OffProcError
    {{ location_data.id }}{{ location_data.location_id }}{{ location_data.table_no }}{{ location_data.tst }}{{ location_data.on_off }}{{ location_data.processed }}{{ location_data.error_msg }}
    -{% else %} -

    No data available.

    -{% endif %} + {% if object_list %} +

    Location Data

    + + + + + + + + + + + {% for location_data in object_list %} + + + + + + + + + + {% endfor %} +
    IDLocationTableTimestampOn_OffProcError
    {{ location_data.id }}{{ location_data.location_id }}{{ location_data.table_no }}{{ location_data.tst }}{{ location_data.on_off }}{{ location_data.processed }}{{ location_data.error_msg }}
    + {% else %} +

    No data available.

    + {% endif %} {% endblock %} diff --git a/billard/templatetags/display_client.py b/billard/templatetags/display_client.py index fe6157a..d15f81a 100644 --- a/billard/templatetags/display_client.py +++ b/billard/templatetags/display_client.py @@ -1,7 +1,9 @@ +from datetime import datetime, timedelta + from django import template from django.utils.html import format_html + from billard import utils -from datetime import datetime register = template.Library() @@ -32,19 +34,22 @@ def display_client(client, desk_no): prize = '{0:.2f}'.format(prize) if prize != a.prize: a.prize = prize - html = '
    \n' + before5min = datetime.now() - timedelta(minutes=5) + if client.last_seen is not None and client.last_seen < before5min: + alert = 'alert-danger' + html = '
    \n' html += '
    \n'.format(alert) html += '

    ({}) {}

    \n'.format(desk_no, desk.name) if loc.happy_hour_start is not None and desk.prize_hh is not None: - html += '
    Preis: {:.2f} € / Stunde | {} - {}: {:.2f} / € Stunde
    \n'\ + html += '
    Preis: {:.2f} € / Stunde | {} - {}: {:.2f} / € Stunde
    \n' \ .format( - desk.prize, - loc.happy_hour_start.strftime('%H:%M'), - loc.happy_hour_end.strftime('%H:%M'), - desk.prize_hh,) + desk.prize, + loc.happy_hour_start.strftime('%H:%M'), + loc.happy_hour_end.strftime('%H:%M'), + desk.prize_hh, ) else: html += '
    Preis: {0:.2f} / Stunde
    \n'.format( - desk.prize,) + desk.prize, ) if len(acc) > 0: html += ' \n' for a in acc: @@ -52,7 +57,7 @@ def display_client(client, desk_no): html += ' \n'.format(a.time_from.strftime('%d.%m.%Y %H:%M:%S')) html += ' \n'.format( (a.time_to.strftime('%d.%m.%Y %H:%M:%S') if a.time_to is not None else '')) - html += ' \n'\ + html += ' \n' \ .format((a.prize if a.prize is not None else '')) html += ' \n' html += ' \n' diff --git a/billard/templatetags/form_tags.py b/billard/templatetags/form_tags.py index 8c89b26..d2c518f 100644 --- a/billard/templatetags/form_tags.py +++ b/billard/templatetags/form_tags.py @@ -1,4 +1,5 @@ from django import template +from django.conf import settings register = template.Library() @@ -17,3 +18,8 @@ def input_class(bound_field): elif field_type(bound_field) != 'PasswordInput': css_class = 'is-valid' return 'form-control {}'.format(css_class) + + +@register.simple_tag +def settings_value(name): + return getattr(settings, name, '') diff --git a/billard/tests.py b/billard/tests.py index e738093..b1cc778 100644 --- a/billard/tests.py +++ b/billard/tests.py @@ -38,7 +38,7 @@ class PrizeCalculationTestCase(TestCase): class PrizeGetTestCase(TestCase): - def get_prize_for(self, start, end, pph=0, hh_start=None, hh_end=None, pphh=0, expected=(0,0,0)): + def get_prize_for(self, start, end, pph=0, hh_start=None, hh_end=None, pphh=0, expected=(0, 0, 0)): self.assertEqual(get_prize_for(start, end, pph, hh_start, hh_end, pphh), expected) def test_gpf_1(self): @@ -109,4 +109,4 @@ class PrizeGetTestCase(TestCase): pph = 10 pphh = 5 expected = (7.5, 5, 2.5) - self.get_prize_for(start, end, pph, hh_start, hh_end, pphh, expected) \ No newline at end of file + self.get_prize_for(start, end, pph, hh_start, hh_end, pphh, expected) diff --git a/billard/urls.py b/billard/urls.py index b02463d..a28b8b8 100644 --- a/billard/urls.py +++ b/billard/urls.py @@ -1,28 +1,30 @@ -from django.conf.urls import url, include +from django.conf.urls import include from django.contrib.auth.decorators import login_required +from django.urls import path from rest_framework import routers + from billard import views router = routers.DefaultRouter() router.register(r'locationdata', views.LocationDataViewSet) +router.register(r'last_seen', views.ClientUpdateLastSeenViewSet) app_name = 'billard' urlpatterns = [ # ex. /billard/ - url(r'^$', login_required(views.LocationIndexView.as_view()), name='location_index'), + path('', login_required(views.LocationIndexView.as_view()), name='location_index'), # ex. /billard/1/ - url(r'^(?P[0-9]+)/$', login_required(views.LocationDetailView.as_view()), name='location_detail'), + path('/', login_required(views.LocationDetailView.as_view()), name='location_detail'), # ex. /billard/1/accounting/ - url(r'^(?P[0-9]+)/accounting/$', views.AccountingView.as_view(), name='accounting_detail'), + path('/accounting/', views.AccountingView.as_view(), name='accounting_detail'), # ex. /billard/1/accounting/confirm - url(r'^(?P[0-9]+)/accounting/confirm/$', views.accounting_confirm, name='accounting_detail_confirm'), + path('/accounting/confirm/', views.accounting_confirm, name='accounting_detail_confirm'), # ex. /billard/1/account_modal/ - url(r'^(?P[0-9]+)/account_modal/$', views.account_modal_view, name='account_modal'), + path('/account_modal/', views.account_modal_view, name='account_modal'), # ex. /billard/1/account_modal/confirm/ - url(r'^(?P[0-9]+)/account_modal/(?P[0-9]+(,[0-9]+)*)/confirm/$', views.account_modal_confirm_view, - name='account_modal_confirm'), + path('/account_modal//confirm/', views.account_modal_confirm_view, name='account_modal_confirm'), # ex. /billard/api/v1/ (rest api) - url(r'api/v1/', include(router.urls)), + path('api/v1/', include(router.urls)), # ex. /billard/process_location_data/ - url(r'^process_location_data/$', views.process_location_data, name='process_location_data'), + path('process_location_data/', views.process_location_data, name='process_location_data'), ] diff --git a/billard/utils.py b/billard/utils.py index 9f8b6f0..29db778 100644 --- a/billard/utils.py +++ b/billard/utils.py @@ -1,4 +1,4 @@ -from datetime import datetime, date, time, timedelta +from datetime import datetime, date, timedelta def get_prize_for(start, end, pph=0, hh_start=None, hh_end=None, pphh=0): diff --git a/billard/views.py b/billard/views.py index f0ef987..2b737d9 100644 --- a/billard/views.py +++ b/billard/views.py @@ -1,18 +1,18 @@ import ast import logging -from billard.serializers import LocationDataSerializer -from billard.models import LocationData, Location, Client, Accounting -from billard.tasks import process_location_data -from rest_framework import viewsets -from django.shortcuts import render, redirect -from django.views import generic from django.contrib.auth.decorators import login_required, permission_required from django.db.models import Sum from django.http import HttpResponse -from django.utils.decorators import method_decorator +from django.shortcuts import render, redirect from django.utils import timezone +from django.utils.decorators import method_decorator +from django.views import generic +from rest_framework import viewsets +from billard.models import LocationData, Location, Client, Accounting +from billard.serializers import LocationDataSerializer, ClientUpdateLastSeenSerializer +from billard.tasks import process_location_data log = logging.getLogger(__name__) @@ -47,7 +47,7 @@ class AccountingView(generic.ListView): context_object_name = 'accounting' def get_queryset(self): - return Accounting.objects.filter(billed=False).filter(desk__client__location_id=self.kwargs['pk'])\ + return Accounting.objects.filter(billed=False).filter(desk__client__location_id=self.kwargs['pk']) \ .exclude(time_to__isnull=True).order_by('time_from') def dispatch(self, request, *args, **kwargs): @@ -108,6 +108,11 @@ class LocationDataViewSet(viewsets.ModelViewSet): serializer_class = LocationDataSerializer +class ClientUpdateLastSeenViewSet(viewsets.ModelViewSet): + queryset = LocationData.objects.all() + serializer_class = ClientUpdateLastSeenSerializer + + def process_location_data(request): process_location_data() return HttpResponse('DONE') diff --git a/caromserver/local_settings_example.py b/caromserver/local_settings_example.py new file mode 100644 index 0000000..4258fa4 --- /dev/null +++ b/caromserver/local_settings_example.py @@ -0,0 +1,33 @@ +import os + +SECRET_KEY = '@-9++2z_6%^vr(f0wax0aq8-pd@0u$*))w!5l^sv#wxrn7k!v-' +DEBUG = True +ALLOWED_HOSTS = ['carom-dev.einsle.de'] +ADMINS = [('Robert Einsle', 'robert@einsle.de'),] + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'carom-dev', + 'USER': 'carom-dev', + 'PASSWORD': 'jex290bjDB4djf0iVKYs', + 'HOST': '127.0.0.1', + 'OPTIONS': { + 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'" + }, + } +} + +STATIC_ROOT = "/srv/carom-dev/carom-server/staticfiles/" + +EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +EMAIL_HOST = 'mail.einsle.de' +EMAIL_PORT = 587 +EMAIL_HOST_USER = 'relay@einsle.de' +EMAIL_HOST_PASSWORD = 'Boaghi0thaiH' +EMAIL_USE_TLS = True +DEFAULT_FROM_EMAIL = "webmaster@einsle.de" + +URL_LOCATION_PROCESSOR = 'https://carom-dev.einsle.de/billard/process_locationdata' + +PRODUCT_INFO = 'carom-dev' diff --git a/caromserver/settings.py b/caromserver/settings.py index 621dd8c..767644f 100644 --- a/caromserver/settings.py +++ b/caromserver/settings.py @@ -37,14 +37,15 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'rest_framework', 'rest_framework.authtoken', + 'debug_toolbar', 'crispy_forms', - 'widget_tweaks', 'billard', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', + 'debug_toolbar.middleware.DebugToolbarMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', @@ -158,6 +159,11 @@ EMAIL_PORT = 25 URL_LOCATION_PROCESSOR = 'http://127.0.0.1:8000/billard/process_locationdata' +PRODUCT_INFO = 'CAROM-DEV' +PRODUCT_VERSION = 'v 0.5.1' + +INTERNAL_IPS = ['127.0.0.1'] + try: from local_settings import * except ImportError: diff --git a/caromserver/urls.py b/caromserver/urls.py index 3943f02..3b29fd7 100644 --- a/caromserver/urls.py +++ b/caromserver/urls.py @@ -13,17 +13,26 @@ Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url, include +from django.conf import settings +from django.conf.urls import include from django.contrib import admin from django.contrib.auth import views as auth_views +from django.urls import path from django.views.generic import RedirectView urlpatterns = [ - url(r'^admin/', admin.site.urls), - url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), - url(r'^billard/', include('billard.urls')), - url(r'^login/$', auth_views.login, name='login'), - url(r'^logout/$', auth_views.logout, name='logout'), - url(r'^', include('django.contrib.auth.urls')), - url(r'^$', RedirectView.as_view(url='billard/', permanent=False), name='index') + path('admin/', admin.site.urls), + path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), + path('billard/', include('billard.urls')), + path('login/', auth_views.login, name='login'), + path('logout/', auth_views.logout, name='logout'), + path('', include('django.contrib.auth.urls')), + path('', RedirectView.as_view(url='billard/', permanent=False), name='index') ] + +if settings.DEBUG: + import debug_toolbar + + urlpatterns = [ + path('__debug__/', include(debug_toolbar.urls)), + ] + urlpatterns diff --git a/requirements.txt b/requirements.txt index e63edac..be753b0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -Django<2.0 +Django<2.1 django-crispy-forms==1.7.0 django-extensions>=1.7.0 djangorestframework>=3.6.0 requests>=2.18.0 -django-widget-tweaks==1.4.1 +django-debug-toolbar<2.0.0 diff --git a/templates/_base.html b/templates/_base.html index 9852361..77da87d 100644 --- a/templates/_base.html +++ b/templates/_base.html @@ -1,10 +1,10 @@ -{% load static %} +{% load static form_tags %} - carom - {% block title %}TITLE SETZEN{% endblock %} + {% settings_value "PRODUCT_INFO" %} - {% block title %}TITLE SETZEN{% endblock %} @@ -26,7 +26,7 @@
    {}{}{}{}