Skip to content

Commit 4044ce2

Browse files
[WEB-4566] feat: add background color and goals field to Profile and Workspace models #7485
1 parent a5f3bd1 commit 4044ce2

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Generated by Django 4.2.22 on 2025-07-27 15:40
2+
3+
from django.db import migrations, models
4+
import plane.utils.color
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('db', '0097_project_external_id_project_external_source'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='profile',
16+
name='background_color',
17+
field=models.CharField(default=plane.utils.color.get_random_color, max_length=255),
18+
),
19+
migrations.AddField(
20+
model_name='profile',
21+
name='goals',
22+
field=models.JSONField(default=dict),
23+
),
24+
migrations.AddField(
25+
model_name='workspace',
26+
name='background_color',
27+
field=models.CharField(default=plane.utils.color.get_random_color, max_length=255),
28+
),
29+
]

apps/api/plane/db/models/user.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# Module imports
1616
from plane.db.models import FileAsset
1717
from ..mixins import TimeAuditModel
18+
from plane.utils.color import get_random_color
1819

1920

2021
def get_default_onboarding():
@@ -222,6 +223,8 @@ class Profile(TimeAuditModel):
222223
start_of_the_week = models.PositiveSmallIntegerField(
223224
choices=START_OF_THE_WEEK_CHOICES, default=SUNDAY
224225
)
226+
goals = models.JSONField(default=dict)
227+
background_color = models.CharField(max_length=255, default=get_random_color)
225228

226229
class Meta:
227230
verbose_name = "Profile"

apps/api/plane/db/models/workspace.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# Module imports
1111
from .base import BaseModel
1212
from plane.utils.constants import RESTRICTED_WORKSPACE_SLUGS
13+
from plane.utils.color import get_random_color
1314

1415
ROLE_CHOICES = ((20, "Admin"), (15, "Member"), (5, "Guest"))
1516

@@ -133,6 +134,7 @@ class Workspace(BaseModel):
133134
)
134135
organization_size = models.CharField(max_length=20, blank=True, null=True)
135136
timezone = models.CharField(max_length=255, default="UTC", choices=TIMEZONE_CHOICES)
137+
background_color = models.CharField(max_length=255, default=get_random_color)
136138

137139
def __str__(self):
138140
"""Return name of the Workspace"""

apps/api/plane/utils/color.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import random
2+
import string
3+
4+
5+
def get_random_color():
6+
"""
7+
Get a random color in hex format
8+
"""
9+
return "#" + "".join(random.choices(string.hexdigits, k=6))

0 commit comments

Comments
 (0)