Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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),
),
]
3 changes: 3 additions & 0 deletions apps/api/plane/db/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# Module imports
from plane.db.models import FileAsset
from ..mixins import TimeAuditModel
from plane.utils.color import get_random_color


def get_default_onboarding():
Expand Down Expand Up @@ -221,6 +222,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"
Expand Down
7 changes: 3 additions & 4 deletions apps/api/plane/db/models/workspace.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Python imports
from django.db.models.functions import Ln
import pytz
import time
from django.utils import timezone
from typing import Optional, Any, Tuple, Dict
from typing import Optional, Any

# Django imports
from django.conf import settings
Expand All @@ -13,6 +10,7 @@
# 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"))

Expand Down Expand Up @@ -136,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"""
Expand Down
9 changes: 9 additions & 0 deletions apps/api/plane/utils/color.py
Original file line number Diff line number Diff line change
@@ -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))
Loading