From 52d515b05e77d5a07145b4314312499b5c6786ff Mon Sep 17 00:00:00 2001 From: Robert Einsle Date: Wed, 26 Apr 2017 10:06:25 +0200 Subject: [PATCH] update requirements --- .../0021_accounting_account_user.py | 22 +++++++++++++++++++ billard/models.py | 4 +--- billard/views.py | 1 + 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 billard/migrations/0021_accounting_account_user.py diff --git a/billard/migrations/0021_accounting_account_user.py b/billard/migrations/0021_accounting_account_user.py new file mode 100644 index 0000000..789da72 --- /dev/null +++ b/billard/migrations/0021_accounting_account_user.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-04-26 09:57 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('billard', '0020_auto_20170410_1853'), + ] + + operations = [ + migrations.AddField( + model_name='accounting', + name='account_user', + field=models.ManyToManyField(related_name='accountings', to=settings.AUTH_USER_MODEL, verbose_name='Abr. Benutzer'), + ), + ] diff --git a/billard/models.py b/billard/models.py index 33aedfe..f343e24 100644 --- a/billard/models.py +++ b/billard/models.py @@ -2,8 +2,6 @@ import uuid import logging from django.db import models from django.contrib.auth.models import User -from datetime import datetime, timezone -from billard import utils from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver @@ -70,7 +68,6 @@ class Desk(models.Model): prize_hh = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, verbose_name="Preis Happy Hour") - def __str__(self): return '{}, {}'.format(self.client.uuid, self.name) @@ -88,6 +85,7 @@ class Accounting(models.Model): 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") + account_user = models.ManyToManyField(User, related_name='accountings', verbose_name="Abr. Benutzer") def __str__(self): return '{}: {} -> {}, {}, {}'.format(self.desk, self.time_from, self.time_to, self.prize, self.billed) diff --git a/billard/views.py b/billard/views.py index d9b091e..0d4a040 100644 --- a/billard/views.py +++ b/billard/views.py @@ -98,6 +98,7 @@ def accounting(request): if 'accountings' in request.POST: acc_ids = request.POST['accountings'].split(',') Accounting.objects.filter(id__in=acc_ids).update(billed=True) + Accounting.objects.filter(id__in=acc_ids).update(account_user=request.user) request.session['loc'] = str(loc) resp = redirect('accounting') resp['Location'] += '?loc={}'.format(str(loc))