From 55cf6101a86f6622a4b3096b8a01a9d186fb9c4e Mon Sep 17 00:00:00 2001 From: Robert Einsle Date: Wed, 26 Apr 2017 10:14:49 +0200 Subject: [PATCH] update accounting model --- billard/migrations/0021_accounting_account_user.py | 5 +++-- billard/models.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/billard/migrations/0021_accounting_account_user.py b/billard/migrations/0021_accounting_account_user.py index 789da72..08094d5 100644 --- a/billard/migrations/0021_accounting_account_user.py +++ b/billard/migrations/0021_accounting_account_user.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11 on 2017-04-26 09:57 +# Generated by Django 1.11 on 2017-04-26 10:14 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): @@ -17,6 +18,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='accounting', name='account_user', - field=models.ManyToManyField(related_name='accountings', to=settings.AUTH_USER_MODEL, verbose_name='Abr. Benutzer'), + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='accountings', to=settings.AUTH_USER_MODEL, verbose_name='Abr. Benutzer'), ), ] diff --git a/billard/models.py b/billard/models.py index f343e24..8360638 100644 --- a/billard/models.py +++ b/billard/models.py @@ -85,7 +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") + account_user = models.OneToOneField(User, related_name='accountings', verbose_name="Abr. Benutzer", blank=True, null=True) def __str__(self): return '{}: {} -> {}, {}, {}'.format(self.desk, self.time_from, self.time_to, self.prize, self.billed)