Source code for sandglass.models.project
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.models import TimeStampedModel
from sandglass.models.accountable import Accountable
from sandglass.models.activityperiod import ActivityPeriod
from sandglass.models.client import Client
from sandglass.models.contactperson import ContactPerson
from sandglass.models.task import Task
[docs]class Project(TimeStampedModel, Accountable, ActivityPeriod):
name = models.CharField(
verbose_name=_(u"name"), max_length=255, db_index=True)
acronym = models.CharField(
verbose_name=_(u"acronym"), max_length=10, db_index=True,
blank=True, null=True)
parent = models.ForeignKey(
'self', verbose_name=_(u"parent"), blank=True, null=True,
help_text=_(u"Define parent project to create groups."))
client = models.ForeignKey(
Client, verbose_name=_(u"client"), blank=True, null=True)
tasks = models.ManyToManyField(
Task, verbose_name=_(u"tasks"), blank=True, null=True)
activity_description_required = models.BooleanField(
verbose_name=_(u"activity description required"), default=False,
help_text=_(u"Do users need to specify a description for activities "
u"added to this project?"))
contact_persons = models.ManyToManyField(
ContactPerson, verbose_name=_(u"contact persons"),
blank=True, null=True)
@property
[docs] def internal(self):
"""Company-internal projects have no ``Client`` assigned."""
return self.client is None
class Meta:
app_label = 'sandglass'
__all__ = ('Project',)