From a246b0fbb6064e3e68f639d1a16ba5623304f0b0 Mon Sep 17 00:00:00 2001 From: Ilse Visser Date: Sun, 16 Aug 2015 15:42:28 +0200 Subject: [PATCH] Add classes to models Create a new app, mercantile, which takes care of everything related to money and calculations. Add classes and variables to the models of both waffles and mercantile. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Your branch is up-to-date with 'origin/master'. # # Changes to be committed: # new file: mercantile/.models.py.swp # new file: mercantile/__init__.py # new file: mercantile/admin.py # new file: mercantile/migrations/__init__.py # new file: mercantile/models.py # new file: mercantile/tests.py # new file: mercantile/views.py # modified: waffles/models.py # # Changes not staged for commit: # modified: .gitignore # --- mercantile/.models.py.swp | Bin 0 -> 12288 bytes mercantile/__init__.py | 0 mercantile/admin.py | 3 +++ mercantile/migrations/__init__.py | 0 mercantile/models.py | 25 +++++++++++++++++++++++++ mercantile/tests.py | 3 +++ mercantile/views.py | 3 +++ waffles/models.py | 29 +++++++++++++++++++++++++++++ 8 files changed, 63 insertions(+) create mode 100644 mercantile/.models.py.swp create mode 100644 mercantile/__init__.py create mode 100644 mercantile/admin.py create mode 100644 mercantile/migrations/__init__.py create mode 100644 mercantile/models.py create mode 100644 mercantile/tests.py create mode 100644 mercantile/views.py diff --git a/mercantile/.models.py.swp b/mercantile/.models.py.swp new file mode 100644 index 0000000000000000000000000000000000000000..81b3a823527cc78cf2658677644c719fafe44de2 GIT binary patch literal 12288 zcmeI2v2GJV5QZo80R*C;TS#L|<}MH+5Qv7DNKs-535;mhzPZhYz1!2?`jDIO1W=^_ zUIHi(6m)q33JQAOfQAm3%bk<6k&G*(pjqkH`ZTjU|9w-PJcHFon>}$OSOZ#T0S;b# z?*G_-4xerVXp^HV%E0`Up?7+?W8M5T*sCrKyI7#HS%Rq#3mF@osxUz}l&RMS!^B2t z@*o@kC0Vc30fsv1|++2pWYgbpxBP*9LiSy_Bi=O5@Ccp%k025#WOn?b60Vco% z{sRI&TY_iw9;fPexmfQ@Gkg8W8xvpxOn?b60Vco%m;e)C0!)AjFaaiT0tv_nAY2A` zLn{COpM3v+I|J~Z^qTaF^pdnkdQ9q&fb{D$z)#Xw(g)H$$&z}cZPFI$I_U!GJKg_< z^p5nFbXe~M@?y(OfC(@GCcp%k025#WOn?b6fqzCo(2|KArC!_-^{Dh_>QSNF&}gDo z8_JYOdV8GEl^&;}IA|Q-unx6Kw{YC*QlJe(BlBE5K<^EfQ`)V%POqHIZr_3xu`QLO zv27s>VY5u_9(*i^zw5#{UHG9+ri#<_chh{M`n@tz`(MQ2x-`R)kzU*MPm8udm+L29 zls}GKc0_EQFjgtDKe0@;uwlC4sGp;|?`%wS>Bqk4f+O_va%bCgSF4#$RiI1gv;Jv9 zSFAgvzKO9Nxw_M02OS0wJDZ57GL8-ALDd_flgv6V4iR=l!*`V(?aEZyAR0^(t7GsR DP!|3E literal 0 HcmV?d00001 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) + +