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 #
This commit is contained in:
parent
61e9ff3ace
commit
a246b0fbb6
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
|
@ -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()
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue