Cosmetic fixes on choices and models of projects app.

remotes/origin/enhancement/email-actions
Andrey Antukh 2014-04-20 03:43:51 +02:00
parent 30a1e58cfb
commit 3927c354e0
2 changed files with 38 additions and 39 deletions

View File

@ -22,52 +22,52 @@ TASK_STATUSES = (
) )
POINTS_CHOICES = ( POINTS_CHOICES = (
(1, u'?', None, True), (1, u"?", None, True),
(2, u'0', 0, False), (2, u"0", 0, False),
(3, u'1/2', 0.5, False), (3, u"1/2", 0.5, False),
(4, u'1', 1, False), (4, u"1", 1, False),
(5, u'2', 2, False), (5, u"2", 2, False),
(6, u'3', 3, False), (6, u"3", 3, False),
(7, u'5', 5, False), (7, u"5", 5, False),
(8, u'8', 8, False), (8, u"8", 8, False),
(9, u'10', 10, False), (9, u"10", 10, False),
(10, u'15', 15, False), (10, u"15", 15, False),
(11, u'20', 20, False), (11, u"20", 20, False),
(12, u'40', 40, False), (12, u"40", 40, False),
) )
PRIORITY_CHOICES = ( PRIORITY_CHOICES = (
(1, _(u'Low'), '#666666', False), (1, _(u"Low"), "#666666", False),
(3, _(u'Normal'), '#669933', True), (3, _(u"Normal"), "#669933", True),
(5, _(u'High'), '#CC0000', False), (5, _(u"High"), "#CC0000", False),
) )
SEVERITY_CHOICES = ( SEVERITY_CHOICES = (
(1, _(u'Wishlist'), '#666666', False), (1, _(u"Wishlist"), "#666666", False),
(2, _(u'Minor'), '#669933', False), (2, _(u"Minor"), "#669933", False),
(3, _(u'Normal'), '#0000FF', True), (3, _(u"Normal"), "#0000FF", True),
(4, _(u'Important'), '#FFA500', False), (4, _(u"Important"), "#FFA500", False),
(5, _(u'Critical'), '#CC0000', False), (5, _(u"Critical"), "#CC0000", False),
) )
ISSUE_STATUSES = ( ISSUE_STATUSES = (
(1, _("New"), False, '#8C2318', True), (1, _("New"), False, "#8C2318", True),
(2, _("In progress"), False, '#5E8C6A', False), (2, _("In progress"), False, "#5E8C6A", False),
(3, _("Ready for test"), True, '#88A65E', False), (3, _("Ready for test"), True, "#88A65E", False),
(4, _("Closed"), True, '#BFB35A', False), (4, _("Closed"), True, "#BFB35A", False),
(5, _("Needs Info"), False, '#89BAB4', False), (5, _("Needs Info"), False, "#89BAB4", False),
(6, _("Rejected"), True, '#CC0000', False), (6, _("Rejected"), True, "#CC0000", False),
(7, _("Postponed"), False, '#666666', False), (7, _("Postponed"), False, "#666666", False),
) )
ISSUE_TYPES = ( ISSUE_TYPES = (
(1, _(u'Bug'), '#89BAB4', True), (1, _(u"Bug"), "#89BAB4", True),
) )
QUESTION_STATUS = ( QUESTION_STATUS = (
(1, _("Pending"), False, '#FFA500', True), (1, _("Pending"), False, "#FFA500", True),
(2, _("Answered"), False, '#669933', False), (2, _("Answered"), False, "#669933", False),
(3, _("Closed"), True,'#BFB35A', False), (3, _("Closed"), True,"#BFB35A", False),
) )
ROLES = ( ROLES = (

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import itertools import itertools
import collections
import time import time
import reversion
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
@ -17,7 +17,6 @@ from django.utils.translation import ugettext_lazy as _
from django.utils import timezone from django.utils import timezone
from picklefield.fields import PickledObjectField from picklefield.fields import PickledObjectField
import reversion
from taiga.domains.models import DomainMember from taiga.domains.models import DomainMember
from taiga.projects.userstories.models import UserStory from taiga.projects.userstories.models import UserStory
@ -94,6 +93,7 @@ class ProjectDefaults(models.Model):
related_name="+", null=True, blank=True, related_name="+", null=True, blank=True,
verbose_name=_("default questions " verbose_name=_("default questions "
"status")) "status"))
class Meta: class Meta:
abstract = True abstract = True
@ -132,14 +132,14 @@ class Project(ProjectDefaults, models.Model):
is_kanban_activated = models.BooleanField(default=False, null=False, blank=True, is_kanban_activated = models.BooleanField(default=False, null=False, blank=True,
verbose_name=_("active kanban panel")) verbose_name=_("active kanban panel"))
is_wiki_activated = models.BooleanField(default=True, null=False, blank=True, is_wiki_activated = models.BooleanField(default=True, null=False, blank=True,
verbose_name=_("active wiki panel")) verbose_name=_("active wiki panel"))
is_issues_activated = models.BooleanField(default=True, null=False, blank=True, is_issues_activated = models.BooleanField(default=True, null=False, blank=True,
verbose_name=_("active issues panel")) verbose_name=_("active issues panel"))
videoconferences = models.CharField(max_length=250, null=True, blank=True, videoconferences = models.CharField(max_length=250, null=True, blank=True,
choices=choices.VIDEOCONFERENCES_CHOICES, choices=choices.VIDEOCONFERENCES_CHOICES,
verbose_name=_("videoconference system")) verbose_name=_("videoconference system"))
videoconferences_salt = models.CharField(max_length=250, null=True, blank=True, videoconferences_salt = models.CharField(max_length=250, null=True, blank=True,
verbose_name=_("videoconference room salt")) verbose_name=_("videoconference room salt"))
domain = models.ForeignKey("domains.Domain", related_name="projects", null=True, blank=True, domain = models.ForeignKey("domains.Domain", related_name="projects", null=True, blank=True,
default=None, verbose_name=_("domain")) default=None, verbose_name=_("domain"))
@ -231,13 +231,13 @@ class Project(ProjectDefaults, models.Model):
@property @property
def future_team_increment(self): def future_team_increment(self):
team_increment = self._get_points_increment(False, True) team_increment = self._get_points_increment(False, True)
shared_increment = {key: value/2 for key, value in self.future_shared_increment.items()} shared_increment = {key: value / 2 for key, value in self.future_shared_increment.items()}
return dict_sum(team_increment, shared_increment) return dict_sum(team_increment, shared_increment)
@property @property
def future_client_increment(self): def future_client_increment(self):
client_increment = self._get_points_increment(True, False) client_increment = self._get_points_increment(True, False)
shared_increment = {key: value/2 for key, value in self.future_shared_increment.items()} shared_increment = {key: value / 2 for key, value in self.future_shared_increment.items()}
return dict_sum(client_increment, shared_increment) return dict_sum(client_increment, shared_increment)
@property @property
@ -505,7 +505,6 @@ class QuestionStatus(models.Model):
reversion.register(Project) reversion.register(Project)
reversion.register(Attachment) reversion.register(Attachment)
# On membership object is created/changed, update # On membership object is created/changed, update
# role-points relation. # role-points relation.
@receiver(models.signals.post_save, sender=Membership, @receiver(models.signals.post_save, sender=Membership,
@ -601,7 +600,7 @@ def project_post_save(sender, instance, created, **kwargs):
instance.default_question_status = obj instance.default_question_status = obj
# Permissions # Permissions
for order, slug, name, computable, permissions in choices.ROLES: for order, slug, name, computable, permissions in choices.ROLES:
obj = Role.objects.create(slug=slug, name=name, order=order, computable=computable, project=instance) obj = Role.objects.create(slug=slug, name=name, order=order, computable=computable, project=instance)
for permission in permissions: for permission in permissions:
try: try: