From fbb1c53dd0fe86e01753752cccde3bf7b0b20386 Mon Sep 17 00:00:00 2001 From: CVi Date: Sun, 16 Aug 2015 16:03:06 +0200 Subject: [PATCH] Now including migrations. --- mercantile/migrations/0001_initial.py | 50 +++++++++++ mercantile/models.py | 7 +- vafling/settings.py | 1 + waffles/migrations/0002_auto_20150816_1357.py | 82 +++++++++++++++++++ 4 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 mercantile/migrations/0001_initial.py create mode 100644 waffles/migrations/0002_auto_20150816_1357.py diff --git a/mercantile/migrations/0001_initial.py b/mercantile/migrations/0001_initial.py new file mode 100644 index 0000000..ac42f7b --- /dev/null +++ b/mercantile/migrations/0001_initial.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('waffles', '0002_auto_20150816_1357'), + ] + + operations = [ + migrations.CreateModel( + name='Calculation', + fields=[ + ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)), + ('date', models.DateTimeField()), + ], + ), + migrations.CreateModel( + name='Debt', + fields=[ + ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)), + ('amount', models.BigIntegerField()), + ('debtee', models.ForeignKey(related_name='debtee', to=settings.AUTH_USER_MODEL)), + ('debtor', models.ForeignKey(related_name='debtor', to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Settlement', + fields=[ + ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)), + ('dato', models.DateField()), + ('amount', models.IntegerField()), + ('debt', models.ForeignKey(to='mercantile.Debt')), + ], + ), + migrations.AddField( + model_name='calculation', + name='debt', + field=models.ForeignKey(to='mercantile.Debt'), + ), + migrations.AddField( + model_name='calculation', + name='event', + field=models.ForeignKey(to='waffles.Event'), + ), + ] diff --git a/mercantile/models.py b/mercantile/models.py index 01dd26b..c5454dc 100644 --- a/mercantile/models.py +++ b/mercantile/models.py @@ -1,12 +1,15 @@ from django.db import models + from waffles.models import Event, UserProfile + + # Create your models here. class Debt(models.Model): amount = models.BigIntegerField() - debtor = models.ForeignKey(UserProfile) - debtee = models.ForeignKey(UserProfile) + debtor = models.ForeignKey(UserProfile, related_name="debtor") + debtee = models.ForeignKey(UserProfile, related_name="debtee") # oversikt over oppgjør, for logging diff --git a/vafling/settings.py b/vafling/settings.py index 4f10bc9..5e79cf4 100644 --- a/vafling/settings.py +++ b/vafling/settings.py @@ -38,6 +38,7 @@ INSTALLED_APPS = ( 'django.contrib.messages', 'django.contrib.staticfiles', 'waffles', + 'mercantile' ) MIDDLEWARE_CLASSES = ( diff --git a/waffles/migrations/0002_auto_20150816_1357.py b/waffles/migrations/0002_auto_20150816_1357.py new file mode 100644 index 0000000..e86e8e4 --- /dev/null +++ b/waffles/migrations/0002_auto_20150816_1357.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +import datetime + +from django.db import models, migrations +from django.utils.timezone import utc +from django.conf import settings + + +class Migration(migrations.Migration): + dependencies = [ + ('waffles', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Listing', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('timeFrom', models.DateTimeField()), + ('timeTo', models.DateTimeField()), + ('description', models.TextField()), + ('community', models.ForeignKey(to='waffles.Community')), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='ShoppingList', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=64)), + ('price', models.IntegerField()), + ('payers', models.ManyToManyField(to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Subevent', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=64)), + ], + ), + migrations.AddField( + model_name='event', + name='participants', + field=models.ManyToManyField(to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='event', + name='status', + field=models.BooleanField(default=datetime.datetime(2015, 8, 16, 13, 56, 47, 395852, tzinfo=utc)), + preserve_default=False, + ), + migrations.AddField( + model_name='event', + name='timeFrom', + field=models.DateTimeField(default=datetime.datetime(2015, 8, 16, 13, 56, 56, 586943, tzinfo=utc)), + preserve_default=False, + ), + migrations.AddField( + model_name='event', + name='timeTo', + field=models.DateTimeField(default=datetime.datetime(2015, 8, 16, 13, 57, 0, 178924, tzinfo=utc)), + preserve_default=False, + ), + migrations.AddField( + model_name='subevent', + name='event', + field=models.ForeignKey(to='waffles.Event'), + ), + migrations.AddField( + model_name='subevent', + name='participants', + field=models.ManyToManyField(to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='shoppinglist', + name='subevent', + field=models.ForeignKey(to='waffles.Subevent'), + ), + ]