Source code for sandglass.models.accountable

from django.core.validators import MinValueValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _


ACCOUNTING_TYPE_EFFORT = 'effort'
ACCOUNTING_TYPE_LUMPSUM = 'lumpsum'
ACCOUNTING_TYPES = (
    (ACCOUNTING_TYPE_EFFORT, _(u"by effort")),
    (ACCOUNTING_TYPE_LUMPSUM, _(u"lump-sum")),
)


[docs]class Accountable(models.Model): """*Abstract* base model for **accountable objects**. An accountable objects basically *has a price*. Depending on the accounting type (by effort or lump-sum), the objects can define an hours budget or a cost estimate (or both). """ accounting_type = models.CharField( verbose_name=_(u"accounting type"), choices=ACCOUNTING_TYPES, max_length=20, default=ACCOUNTING_TYPE_EFFORT, db_index=True) hours_budget = models.FloatField( verbose_name=_(u"hours budget"), blank=True, null=True, validators=[MinValueValidator(0)]) cost_estimate = models.DecimalField( verbose_name=_(u"cost estimate"), max_digits=10, decimal_places=2, blank=True, null=True, validators=[MinValueValidator(0)]) class Meta: app_label = 'sandglass' abstract = True
__all__ = ('Accountable',)

Project Versions