2014-05-27 15:55:09 +00:00
|
|
|
from django.db import models
|
2014-05-08 16:59:35 +00:00
|
|
|
from django.contrib.contenttypes import generic
|
|
|
|
from django.contrib.contenttypes.models import ContentType
|
2014-05-27 15:55:09 +00:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2014-05-08 16:59:35 +00:00
|
|
|
|
|
|
|
from . import settings
|
|
|
|
|
|
|
|
|
|
|
|
class Order(models.Model):
|
2014-05-27 15:55:09 +00:00
|
|
|
account = models.ForeignKey('accounts.Account', verbose_name=_("account"),
|
|
|
|
related_name='orders')
|
2014-05-08 16:59:35 +00:00
|
|
|
content_type = models.ForeignKey(ContentType)
|
|
|
|
object_id = models.PositiveIntegerField(null=True)
|
2014-05-27 15:55:09 +00:00
|
|
|
price = models.ForeignKey(settings.ORDERS_PRICE_MODEL,
|
|
|
|
verbose_name=_("price"), related_name='orders')
|
2014-05-08 16:59:35 +00:00
|
|
|
registered_on = models.DateTimeField(_("registered on"), auto_now_add=True)
|
2014-05-27 15:55:09 +00:00
|
|
|
cancelled_on = models.DateTimeField(_("cancelled on"), null=True, blank=True)
|
|
|
|
billed_on = models.DateTimeField(_("billed on"), null=True, blank=True)
|
2014-05-08 16:59:35 +00:00
|
|
|
billed_until = models.DateTimeField(_("billed until"), null=True, blank=True)
|
|
|
|
ignore = models.BooleanField(_("ignore"), default=False)
|
2014-05-27 15:55:09 +00:00
|
|
|
description = models.TextField(_("description"), blank=True)
|
2014-05-08 16:59:35 +00:00
|
|
|
|
|
|
|
content_object = generic.GenericForeignKey()
|
|
|
|
|
|
|
|
def __unicode__(self):
|
2014-05-27 15:55:09 +00:00
|
|
|
return self.service
|
|
|
|
|
2014-05-08 16:59:35 +00:00
|
|
|
|
2014-05-27 15:55:09 +00:00
|
|
|
class QuotaStorage(models.Model):
|
|
|
|
order = models.ForeignKey(Order, verbose_name=_("order"))
|
|
|
|
value = models.BigIntegerField(_("value"))
|
|
|
|
date = models.DateTimeField(_("date"))
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.order
|