update requirements

This commit is contained in:
Robert Einsle 2017-04-26 10:06:25 +02:00
parent c7efbffc8f
commit 52d515b05e
3 changed files with 24 additions and 3 deletions

View File

@ -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'),
),
]

View File

@ -2,8 +2,6 @@ import uuid
import logging import logging
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 datetime import datetime, timezone
from billard import utils
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
@ -70,7 +68,6 @@ class Desk(models.Model):
prize_hh = 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 Happy Hour")
def __str__(self): def __str__(self):
return '{}, {}'.format(self.client.uuid, self.name) 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') 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, verbose_name="Preis Normalzeit")
prize_hh = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, verbose_name="Preis Happy Hour") 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): def __str__(self):
return '{}: {} -> {}, {}, {}'.format(self.desk, self.time_from, self.time_to, self.prize, self.billed) return '{}: {} -> {}, {}, {}'.format(self.desk, self.time_from, self.time_to, self.prize, self.billed)

View File

@ -98,6 +98,7 @@ def accounting(request):
if 'accountings' in request.POST: if 'accountings' in request.POST:
acc_ids = request.POST['accountings'].split(',') acc_ids = request.POST['accountings'].split(',')
Accounting.objects.filter(id__in=acc_ids).update(billed=True) 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) request.session['loc'] = str(loc)
resp = redirect('accounting') resp = redirect('accounting')
resp['Location'] += '?loc={}'.format(str(loc)) resp['Location'] += '?loc={}'.format(str(loc))