mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
dev: back migration to update label colors (#664)
This commit is contained in:
@@ -3,7 +3,7 @@ import uuid
|
||||
import random
|
||||
from django.contrib.auth.hashers import make_password
|
||||
from plane.db.models import ProjectIdentifier
|
||||
from plane.db.models import Issue, IssueComment, User, Project
|
||||
from plane.db.models import Issue, IssueComment, User, Project, Label
|
||||
|
||||
|
||||
# Update description and description html values for old descriptions
|
||||
@@ -134,3 +134,18 @@ def update_project_cover_images():
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("Failed")
|
||||
|
||||
|
||||
def update_label_color():
|
||||
try:
|
||||
labels = Label.objects.filter(color="")
|
||||
updated_labels = []
|
||||
for label in labels:
|
||||
label.color = "#" + "%06x" % random.randint(0, 0xFFFFFF)
|
||||
updated_labels.append(label)
|
||||
|
||||
Label.objects.bulk_update(updated_labels, ["color"], batch_size=100)
|
||||
print("Success")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("Failed")
|
||||
|
||||
Reference in New Issue
Block a user