Now including migrations.

This commit is contained in:
Christoffer Viken 2015-08-16 16:03:06 +02:00
parent 43d2ad6352
commit fbb1c53dd0
4 changed files with 138 additions and 2 deletions

View File

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

View File

@ -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

View File

@ -38,6 +38,7 @@ INSTALLED_APPS = (
'django.contrib.messages',
'django.contrib.staticfiles',
'waffles',
'mercantile'
)
MIDDLEWARE_CLASSES = (

View File

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