[Backport] Transforming tags to lowercase on creation
parent
5a9938931e
commit
6354ac1c07
|
@ -24,12 +24,12 @@ def tag_exist_for_project_elements(project, tag):
|
|||
|
||||
|
||||
def create_tags(project, new_tags_colors):
|
||||
project.tags_colors += [[k, v] for k, v in new_tags_colors.items()]
|
||||
project.tags_colors += [[k.lower(), v] for k, v in new_tags_colors.items()]
|
||||
project.save(update_fields=["tags_colors"])
|
||||
|
||||
|
||||
def create_tag(project, tag, color):
|
||||
project.tags_colors.append([tag, color])
|
||||
project.tags_colors.append([tag.lower(), color])
|
||||
project.save(update_fields=["tags_colors"])
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class CreateTagValidator(ProjectTagValidator):
|
|||
|
||||
def validate_color(self, attrs, source):
|
||||
color = attrs.get(source, None)
|
||||
if color is not None and not re.match('^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$', color):
|
||||
if color and not re.match('^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$', color):
|
||||
raise ValidationError(_("The color is not a valid HEX color."))
|
||||
|
||||
return attrs
|
||||
|
|
Loading…
Reference in New Issue