2015-08-16 15:42:28 +02:00
|
|
|
from django.db import models
|
2015-08-16 16:03:06 +02:00
|
|
|
|
2015-08-16 15:42:28 +02:00
|
|
|
from waffles.models import Event, UserProfile
|
2015-08-16 16:03:06 +02:00
|
|
|
|
|
|
|
|
2015-08-16 15:42:28 +02:00
|
|
|
# Create your models here.
|
|
|
|
|
|
|
|
|
|
|
|
class Debt(models.Model):
|
|
|
|
amount = models.BigIntegerField()
|
2015-08-16 16:03:06 +02:00
|
|
|
debtor = models.ForeignKey(UserProfile, related_name="debtor")
|
|
|
|
debtee = models.ForeignKey(UserProfile, related_name="debtee")
|
2015-08-16 15:42:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
# 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()
|
|
|
|
|
|
|
|
|