Normalize tags list on save issue and userstory.

remotes/origin/enhancement/email-actions
Andrey Antukh 2013-11-05 15:19:42 +01:00
parent 271f2ef6c7
commit 8ee3554720
2 changed files with 10 additions and 0 deletions

View File

@ -106,3 +106,8 @@ def issue_finished_date_handler(sender, instance, **kwargs):
def issue_ref_handler(sender, instance, **kwargs):
if not instance.id and instance.project:
instance.ref = ref_uniquely(instance.project, "last_issue_ref", instance.__class__)
@receiver(models.signals.pre_save, sender=Issue, dispatch_uid="issue-tags-normalization")
def issue_tags_normalization(sender, instance, **kwargs):
if isinstance(instance.tags, (list, tuple)):
instance.tags = list(map(lambda x: x.lower(), instance.tags))

View File

@ -146,3 +146,8 @@ def us_create_role_points_handler(sender, instance, **kwargs):
def us_task_reassignation(sender, instance, created, **kwargs):
if not created:
instance.tasks.update(milestone=instance.milestone)
@receiver(models.signals.pre_save, sender=UserStory, dispatch_uid="us-tags-normalization")
def us_tags_normalization(sender, instance, **kwargs):
if isinstance(instance.tags, (list, tuple)):
instance.tags = list(map(lambda x: x.lower(), instance.tags))