Fix bug #930: on back

remotes/origin/enhancement/email-actions
Jesús Espino 2014-09-10 18:06:25 +02:00
parent c62e0e05fc
commit 6cacb81820
1 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,7 @@ from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.core.exceptions import ValidationError
from taiga.base.utils.slug import slugify_uniquely
from taiga.base.utils.dicts import dict_sum
@ -68,6 +69,11 @@ class Milestone(WatchedModelMixin, models.Model):
def __repr__(self):
return "<Milestone {0}>".format(self.id)
def clean(self):
# Don't allow draft entries to have a pub_date.
if self.estimated_start and self.estimated_finish and self.estimated_start > self.estimated_finish:
raise ValidationError('The estimated start must be previous to the estimated finish.')
def save(self, *args, **kwargs):
if not self._importing or not self.modified_date:
self.modified_date = timezone.now()