Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WEB-4566] feat: add background color and goals field to Profile and Workspace models #7485

Nikhil4044ce25ce9b
diff --git a/apps/api/plane/db/migrations/0098_profile_background_color_profile_goals_and_more.py b/apps/api/plane/db/migrations/0098_profile_background_color_profile_goals_and_more.py
new file mode 100644
index 0000000000..b736018afa
--- /dev/null
+++ b/apps/api/plane/db/migrations/0098_profile_background_color_profile_goals_and_more.py
@@ -0,0 +1,29 @@
+# Generated by Django 4.2.22 on 2025-07-27 15:40
+
+from django.db import migrations, models
+import plane.utils.color
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('db', '0097_project_external_id_project_external_source'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='profile',
+ name='background_color',
+ field=models.CharField(default=plane.utils.color.get_random_color, max_length=255),
+ ),
+ migrations.AddField(
+ model_name='profile',
+ name='goals',
+ field=models.JSONField(default=dict),
+ ),
+ migrations.AddField(
+ model_name='workspace',
+ name='background_color',
+ field=models.CharField(default=plane.utils.color.get_random_color, max_length=255),
+ ),
+ ]
diff --git a/apps/api/plane/db/models/user.py b/apps/api/plane/db/models/user.py
index bad81b4ceb..c1a482e2a3 100644
--- a/apps/api/plane/db/models/user.py
+++ b/apps/api/plane/db/models/user.py
@@ -15,6 +15,7 @@ from django.utils import timezone
# Module imports
from plane.db.models import FileAsset
from ..mixins import TimeAuditModel
+from plane.utils.color import get_random_color
def get_default_onboarding():
@@ -222,6 +223,8 @@ class Profile(TimeAuditModel):
start_of_the_week = models.PositiveSmallIntegerField(
choices=START_OF_THE_WEEK_CHOICES, default=SUNDAY
)
+ goals = models.JSONField(default=dict)
+ background_color = models.CharField(max_length=255, default=get_random_color)
class Meta:
verbose_name = "Profile"
diff --git a/apps/api/plane/db/models/workspace.py b/apps/api/plane/db/models/workspace.py
index 3f9f612dce..cb176086dd 100644
--- a/apps/api/plane/db/models/workspace.py
+++ b/apps/api/plane/db/models/workspace.py
@@ -10,6 +10,7 @@ from django.db import models
# Module imports
from .base import BaseModel
from plane.utils.constants import RESTRICTED_WORKSPACE_SLUGS
+from plane.utils.color import get_random_color
ROLE_CHOICES = ((20, "Admin"), (15, "Member"), (5, "Guest"))
@@ -133,6 +134,7 @@ class Workspace(BaseModel):
)
organization_size = models.CharField(max_length=20, blank=True, null=True)
timezone = models.CharField(max_length=255, default="UTC", choices=TIMEZONE_CHOICES)
+ background_color = models.CharField(max_length=255, default=get_random_color)
def __str__(self):
"""Return name of the Workspace"""
diff --git a/apps/api/plane/utils/color.py b/apps/api/plane/utils/color.py
new file mode 100644
index 0000000000..8c45389bdf
--- /dev/null
+++ b/apps/api/plane/utils/color.py
@@ -0,0 +1,9 @@
+import random
+import string
+
+
+def get_random_color():
+ """
+ Get a random color in hex format
+ """
+ return "#" + "".join(random.choices(string.hexdigits, k=6))