mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
dev: back migration to update label colors (#664)
This commit is contained in:
parent
d990f0038b
commit
1bb93f1f50
@ -3,7 +3,7 @@ import uuid
|
|||||||
import random
|
import random
|
||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
from plane.db.models import ProjectIdentifier
|
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
|
# Update description and description html values for old descriptions
|
||||||
@ -134,3 +134,18 @@ def update_project_cover_images():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
print("Failed")
|
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")
|
||||||
|
Loading…
Reference in New Issue
Block a user