reformat code

This commit is contained in:
Robert Einsle 2018-02-11 10:56:44 +01:00
parent 076808f183
commit d9d78a969f
43 changed files with 265 additions and 248 deletions

View File

@ -1,11 +1,10 @@
from django import forms
from django.conf.urls import url from django.conf.urls import url
from django.contrib import admin, messages from django.contrib import admin, messages
from django.core.exceptions import ValidationError
from django.shortcuts import redirect from django.shortcuts import redirect
from django.template.response import TemplateResponse
from .models import * from .models import *
from django import forms
from django.core.exceptions import ValidationError
class LocationAdminForm(forms.ModelForm): class LocationAdminForm(forms.ModelForm):
@ -26,7 +25,8 @@ class LocationAdminForm(forms.ModelForm):
class LocationAdmin(admin.ModelAdmin): class LocationAdmin(admin.ModelAdmin):
form = LocationAdminForm form = LocationAdminForm
list_display = ('code', 'name', 'city', 'happy_hour_start', 'happy_hour_end') 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) @admin.register(Client)
@ -40,13 +40,15 @@ class LocationDataAdmin(admin.ModelAdmin):
def get_urls(self): def get_urls(self):
urls = super().get_urls() urls = super().get_urls()
my_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 return my_urls + urls
def process_locationdata(self, request): def process_locationdata(self, request):
messages.success(request, 'Items processed.') messages.success(request, 'Items processed.')
return redirect('admin:billard_locationdata_changelist') return redirect('admin:billard_locationdata_changelist')
list_display = ('client_id', 'desk_no', 'tst', 'on_off', 'processed', 'error_msg') list_display = ('client_id', 'desk_no', 'tst', 'on_off', 'processed', 'error_msg')
fields = ['client_id', 'desk_no', 'tst', 'on_off', 'processed', 'error_msg'] fields = ['client_id', 'desk_no', 'tst', 'on_off', 'processed', 'error_msg']

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [

View File

@ -7,7 +7,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL), migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('billard', '0001_initial'), ('billard', '0001_initial'),

View File

@ -2,13 +2,13 @@
# Generated by Django 1.10.5 on 2017-02-04 05:48 # Generated by Django 1.10.5 on 2017-02-04 05:48
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import uuid import uuid
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0002_location'), ('billard', '0002_location'),
] ]

View File

@ -2,12 +2,11 @@
# Generated by Django 1.10.5 on 2017-02-04 10:17 # Generated by Django 1.10.5 on 2017-02-04 10:17
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0003_client'), ('billard', '0003_client'),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0004_accounting'), ('billard', '0004_accounting'),
] ]

View File

@ -2,14 +2,14 @@
# Generated by Django 1.10.5 on 2017-02-06 19:31 # Generated by Django 1.10.5 on 2017-02-06 19:31
from __future__ import unicode_literals from __future__ import unicode_literals
import uuid
import django.db.models.deletion
from django.conf import settings from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0005_auto_20170206_1926'), ('billard', '0005_auto_20170206_1926'),
] ]
@ -17,7 +17,8 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name='accounting', 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( migrations.AlterModelOptions(
name='client', name='client',
@ -34,7 +35,8 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='accounting', model_name='accounting',
name='client', 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( migrations.AlterField(
model_name='accounting', model_name='accounting',
@ -59,7 +61,8 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='client', model_name='client',
name='location', 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( migrations.AlterField(
model_name='client', model_name='client',
@ -109,7 +112,8 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='location', model_name='location',
name='users', 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( migrations.AlterField(
model_name='locationdata', model_name='locationdata',

View File

@ -2,12 +2,11 @@
# Generated by Django 1.10.5 on 2017-02-10 18:30 # Generated by Django 1.10.5 on 2017-02-10 18:30
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0006_auto_20170206_2031'), ('billard', '0006_auto_20170206_2031'),
] ]
@ -20,9 +19,12 @@ class Migration(migrations.Migration):
('desk_no', models.IntegerField(verbose_name='Tischnummer')), ('desk_no', models.IntegerField(verbose_name='Tischnummer')),
('name', models.CharField(blank=True, max_length=32, null=True, verbose_name='Tischbezeichnung')), ('name', models.CharField(blank=True, max_length=32, null=True, verbose_name='Tischbezeichnung')),
('enabled', models.BooleanField(verbose_name='Tisch aktiv')), ('enabled', models.BooleanField(verbose_name='Tisch aktiv')),
('prize', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, verbose_name='Normelpreis')), ('prize', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True,
('prize_hh', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, verbose_name='Preis Happy Hour')), verbose_name='Normelpreis')),
('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billard.Client', verbose_name='Client')), ('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={ options={
'verbose_name_plural': 'Tische', 'verbose_name_plural': 'Tische',

View File

@ -2,12 +2,11 @@
# Generated by Django 1.10.5 on 2017-02-10 19:47 # Generated by Django 1.10.5 on 2017-02-10 19:47
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0007_desk'), ('billard', '0007_desk'),
] ]
@ -48,6 +47,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='desk', model_name='desk',
name='client', 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'),
), ),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0008_auto_20170210_1947'), ('billard', '0008_auto_20170210_1947'),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0009_auto_20170210_1955'), ('billard', '0009_auto_20170210_1955'),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0010_auto_20170210_2040'), ('billard', '0010_auto_20170210_2040'),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0011_auto_20170210_2122'), ('billard', '0011_auto_20170210_2122'),
] ]

View File

@ -2,12 +2,11 @@
# Generated by Django 1.10.5 on 2017-02-11 09:03 # Generated by Django 1.10.5 on 2017-02-11 09:03
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0012_auto_20170211_1003'), ('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')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time_from', models.DateTimeField(verbose_name='Beginn')), ('time_from', models.DateTimeField(verbose_name='Beginn')),
('time_to', models.DateTimeField(blank=True, null=True, verbose_name='Ende')), ('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')), ('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={ options={
'verbose_name_plural': 'Buchhaltungseinträge', 'verbose_name_plural': 'Buchhaltungseinträge',

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0013_accounting'), ('billard', '0013_accounting'),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0014_auto_20170211_2008'), ('billard', '0014_auto_20170211_2008'),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0015_auto_20170222_1023'), ('billard', '0015_auto_20170222_1023'),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0016_auto_20170225_1822'), ('billard', '0016_auto_20170225_1822'),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0016_auto_20170225_1822'), ('billard', '0016_auto_20170225_1822'),
] ]

View File

@ -2,13 +2,12 @@
# Generated by Django 1.10.5 on 2017-03-02 20:58 # Generated by Django 1.10.5 on 2017-03-02 20:58
from __future__ import unicode_literals from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL), migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('billard', '0017_accounting_reporter_uuid'), ('billard', '0017_accounting_reporter_uuid'),
@ -18,16 +17,20 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='accounting', model_name='accounting',
name='prize_hh', 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( migrations.AddField(
model_name='accounting', model_name='accounting',
name='prize_normal', 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( migrations.AddField(
model_name='client', model_name='client',
name='report_user', 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'),
), ),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0018_auto_20170302_2058'), ('billard', '0018_auto_20170302_2058'),
('billard', '0017_auto_20170302_1610'), ('billard', '0017_auto_20170302_1610'),

View File

@ -4,6 +4,7 @@ from __future__ import unicode_literals
from django.db import migrations from django.db import migrations
def create_default_groups_permissions(apps, schema_editor): def create_default_groups_permissions(apps, schema_editor):
# We can't import the Person model directly as it may be a newer # We can't import the Person model directly as it may be a newer
# version than this migration expects. We use the historical version. # 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.save()
ag.permissions.add(Permission.objects.get(codename="change_accounting")) ag.permissions.add(Permission.objects.get(codename="change_accounting"))
def delete_default_groups_permissions(apps, schema_editor): def delete_default_groups_permissions(apps, schema_editor):
Group = apps.get_model("auth", "Group") Group = apps.get_model("auth", "Group")
Group.objects.get(name='Location').delete() Group.objects.get(name='Location').delete()
@ -23,7 +25,6 @@ def delete_default_groups_permissions(apps, schema_editor):
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0019_merge_20170310_1941'), ('billard', '0019_merge_20170310_1941'),
('sessions', '0001_initial'), ('sessions', '0001_initial'),

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0020_auto_20170410_1853'), ('billard', '0020_auto_20170410_1853'),
] ]

View File

@ -2,12 +2,11 @@
# Generated by Django 1.11 on 2017-04-27 08:35 # Generated by Django 1.11 on 2017-04-27 08:35
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0021_accounting_account_user'), ('billard', '0021_accounting_account_user'),
] ]
@ -16,6 +15,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='client', model_name='client',
name='location', 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'),
), ),
] ]

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0022_auto_20170427_0835'), ('billard', '0022_auto_20170427_0835'),
] ]

View File

@ -1,12 +1,11 @@
# Generated by Django 2.0.2 on 2018-02-10 11:05 # Generated by Django 2.0.2 on 2018-02-10 11:05
import django.db.models.deletion
from django.conf import settings from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('billard', '0023_accounting_account_tst'), ('billard', '0023_accounting_account_tst'),
] ]
@ -15,21 +14,26 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='accounting', model_name='accounting',
name='desk', 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( migrations.AlterField(
model_name='client', model_name='client',
name='location', 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( migrations.AlterField(
model_name='client', model_name='client',
name='report_user', 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( migrations.AlterField(
model_name='desk', model_name='desk',
name='client', 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'),
), ),
] ]

View File

@ -1,8 +1,9 @@
import uuid
import logging 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.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.db.models.signals import post_save
from django.dispatch import receiver from django.dispatch import receiver
@ -49,7 +50,8 @@ class Location(models.Model):
class Client(models.Model): class Client(models.Model):
uuid = models.UUIDField(unique=True, default=uuid.uuid4, verbose_name="Identifier") 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) 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) report_user = models.ForeignKey(User, blank=True, null=True, verbose_name="Reporting Benutzer",
related_name='reporting_clients', on_delete=models.DO_NOTHING)
def __str__(self): def __str__(self):
return '{}, {}'.format(self.location.name, self.uuid) return '{}, {}'.format(self.location.name, self.uuid)
@ -83,8 +85,10 @@ class Accounting(models.Model):
prize = models.DecimalField(max_digits=6, decimal_places=2, blank=True, null=True, verbose_name="Preis") prize = models.DecimalField(max_digits=6, decimal_places=2, blank=True, null=True, verbose_name="Preis")
billed = models.BooleanField(default=False, verbose_name="Abgerechnet") billed = models.BooleanField(default=False, verbose_name="Abgerechnet")
reporter_uuid = models.UUIDField(blank=True, null=True, verbose_name='Reporter UUID') 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_normal = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True,
prize_hh = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, verbose_name="Preis Happy Hour") 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_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") account_tst = models.DateTimeField(blank=True, null=True, verbose_name="Abr. TST")

View File

@ -1,6 +1,7 @@
from billard.models import LocationData
from rest_framework import serializers from rest_framework import serializers
from billard.models import LocationData
class LocationDataSerializer(serializers.HyperlinkedModelSerializer): class LocationDataSerializer(serializers.HyperlinkedModelSerializer):
class Meta: class Meta:

View File

@ -1,8 +1,8 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import logging import logging
import billard.utils as utils
import billard.utils as utils
from billard.models import LocationData, Client, Accounting from billard.models import LocationData, Client, Accounting
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -58,7 +58,8 @@ def process_location_data():
ld.delete() ld.delete()
else: else:
ld.processed = True 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() ld.save()
log.error(ld.error_msg) log.error(ld.error_msg)
except: except:

View File

@ -28,7 +28,8 @@
</table> </table>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-default btn-primary" href="{% url 'billard:account_modal_confirm' pks=pks loc_pk=loc_pk %}">Schliessen</a> <a class="btn btn-default btn-primary"
href="{% url 'billard:account_modal_confirm' pks=pks loc_pk=loc_pk %}">Schliessen</a>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->

View File

@ -10,7 +10,8 @@
<div id="location-selector" class="alert"> <div id="location-selector" class="alert">
<select class="form-control" form="location-form" name="location-selector" id="location-select"> <select class="form-control" form="location-form" name="location-selector" id="location-select">
{% for loc in locations %} {% for loc in locations %}
<option value="{{ loc.id }}"{% if loc.id == location_id %} selected{% endif %}>{{ loc.code }} - {{ loc.name }}</option> <option value="{{ loc.id }}"{% if loc.id == location_id %} selected{% endif %}>{{ loc.code }}
- {{ loc.name }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>

View File

@ -23,13 +23,15 @@
</tr> </tr>
{% for loc in location_list %} {% for loc in location_list %}
<tr> <tr>
<td><a href="{% url 'billard:location_detail' loc.id %}" class="btn btn-outline-primary btn-sm">{{ loc.code|default_if_none:"" }}</a></td> <td><a href="{% url 'billard:location_detail' loc.id %}"
class="btn btn-outline-primary btn-sm">{{ loc.code|default_if_none:"" }}</a></td>
<td>{{ loc.name|default_if_none:"" }}</td> <td>{{ loc.name|default_if_none:"" }}</td>
<td>{{ loc.street|default_if_none:"" }}</td> <td>{{ loc.street|default_if_none:"" }}</td>
<td>{{ loc.plz|default_if_none:"" }}</td> <td>{{ loc.plz|default_if_none:"" }}</td>
<td>{{ loc.city|default_if_none:"" }}</td> <td>{{ loc.city|default_if_none:"" }}</td>
{% if perms.billard.change_accounting %} {% if perms.billard.change_accounting %}
<td><a href="{% url 'billard:accounting_detail' loc.id %}" class="btn btn-outline-danger btn-sm">Abrechnen</a></td> <td><a href="{% url 'billard:accounting_detail' loc.id %}"
class="btn btn-outline-danger btn-sm">Abrechnen</a></td>
{% endif %} {% endif %}
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -9,7 +9,9 @@
{% block js %} {% block js %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
setInterval(function(){$( "#content" ).load( "#")},1000); setInterval(function () {
$("#content").load("#")
}, 1000);
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -9,7 +9,9 @@
{% block js %} {% block js %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
setInterval(function(){$( "#content" ).load( "#")},1000); setInterval(function () {
$("#content").load("#")
}, 1000);
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,7 +1,9 @@
from datetime import datetime
from django import template from django import template
from django.utils.html import format_html from django.utils.html import format_html
from billard import utils from billard import utils
from datetime import datetime
register = template.Library() register = template.Library()

View File

@ -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): def get_prize_for(start, end, pph=0, hh_start=None, hh_end=None, pphh=0):

View File

@ -1,18 +1,18 @@
import ast import ast
import logging 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.contrib.auth.decorators import login_required, permission_required
from django.db.models import Sum from django.db.models import Sum
from django.http import HttpResponse 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 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
from billard.tasks import process_location_data
log = logging.getLogger(__name__) log = logging.getLogger(__name__)