From e35230ae239c78ba91d5ac058a1e3a1db79f65ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bodor=20M=C3=A1t=C3=A9?= <bodor.mate@kszk.bme.hu> Date: Tue, 22 Jan 2019 14:52:10 +0100 Subject: [PATCH] add absent filed to model --- .../migrations/0003_auto_20190122_1449.py | 24 +++++++++++++++++++ src/stats/models.py | 9 ++++--- 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 src/stats/migrations/0003_auto_20190122_1449.py diff --git a/src/stats/migrations/0003_auto_20190122_1449.py b/src/stats/migrations/0003_auto_20190122_1449.py new file mode 100644 index 0000000..a3689e8 --- /dev/null +++ b/src/stats/migrations/0003_auto_20190122_1449.py @@ -0,0 +1,24 @@ +# Generated by Django 2.0.1 on 2019-01-22 13:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('account', '0002_auto_20190122_1341'), + ('stats', '0002_event_description'), + ] + + operations = [ + migrations.AddField( + model_name='event', + name='absent', + field=models.ManyToManyField(blank=True, related_name='events_absent', to='account.Profile'), + ), + migrations.AlterField( + model_name='event', + name='visitors', + field=models.ManyToManyField(blank=True, related_name='events_visitor', to='account.Profile'), + ), + ] diff --git a/src/stats/models.py b/src/stats/models.py index c4fcbec..be95820 100644 --- a/src/stats/models.py +++ b/src/stats/models.py @@ -1,8 +1,6 @@ from django.db import models from account.models import Profile from common.middleware import CurrentUserMiddleware -from django.utils import timezone -from django.core.exceptions import ValidationError class Event(models.Model): @@ -11,7 +9,12 @@ class Event(models.Model): description = models.TextField(blank=True, default='') visitors = models.ManyToManyField( Profile, - related_name='events', + related_name='events_visitor', + blank=True + ) + absent = models.ManyToManyField( + Profile, + related_name='events_absent', blank=True ) created_by = models.ForeignKey( -- GitLab