from django db import models from django contrib auth models import Us

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from logs.models import Campaign
class Earning(models.Model):
STATUS_PENDING = 0
STATUS_PAID = 1
STATUS_CHOICES = (
(STATUS_PENDING, _('Pending')),
(STATUS_PAID, _('Paid'),
)
payer = models.ForeignKey(User)
acceptor = models.ForeignKey(User)
amount = models.DecimalField(max_digits=10, decimal_places=2)
campaign = models.ForeignKey(Campaign)
date_start = models.DateTimeField()
date_end = models.DateTimeField()
status = models.SmallIntegerField(choices=STATUS_CHOICES)
class Payment(models.Model):
payer = models.ForeignKey(User)
acceptor = models.ForeignKey(User)
amount = models.DecimalField(max_digits=10, decimal_places=2)
date = models.DateTimeField()