diff --git a/mercantile/.models.py.swp b/mercantile/.models.py.swp new file mode 100644 index 0000000..81b3a82 Binary files /dev/null and b/mercantile/.models.py.swp differ diff --git a/mercantile/__init__.py b/mercantile/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mercantile/admin.py b/mercantile/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/mercantile/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/mercantile/migrations/__init__.py b/mercantile/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mercantile/models.py b/mercantile/models.py new file mode 100644 index 0000000..01dd26b --- /dev/null +++ b/mercantile/models.py @@ -0,0 +1,25 @@ +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) + + +# oversikt over oppgjør, for logging +class Calculation(models.Model): + debt = models.ForeignKey(Debt) + event = models.ForeignKey(Event) + date = models.DateTimeField() + + +# Lagring av oppgjør +class Settlement(models.Model): + debt = models.ForeignKey(Debt) + dato = models.DateField() + amount = models.IntegerField() + + diff --git a/mercantile/tests.py b/mercantile/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/mercantile/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/mercantile/views.py b/mercantile/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/mercantile/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/waffles/models.py b/waffles/models.py index b3e42e4..adebf00 100644 --- a/waffles/models.py +++ b/waffles/models.py @@ -14,6 +14,35 @@ class Community(models.Model): members = models.ManyToManyField(UserProfile) +# Jeg har lyst til å vafle! +# Er det noen som er med? +class Listing(models.Model): + community = models.ForeignKey(Community) + timeFrom = models.DateTimeField() + timeTo = models.DateTimeField() + user = models.ForeignKey(UserProfile) + description = models.TextField() + + class Event(models.Model): name = models.CharField(max_length=64) description = models.TextField() + status = models.BooleanField() # closed - no more edits + participants = models.ManyToManyField(UserProfile) + timeFrom = models.DateTimeField() + timeTo = models.DateTimeField() + + +class Subevent(models.Model): + name = models.CharField(max_length=64) + participants = models.ManyToManyField(UserProfile) + event = models.ForeignKey(Event) + + +class ShoppingList(models.Model): + name = models.CharField(max_length=64) + price = models.IntField + payers = models.ManyToManyField(UserProfile) + subevent = models.ForeignKey(Subevent) + +