[WEB-4566] feat: add background color and goals field to Profile and Workspace models #7485
This commit is contained in:
parent
a5f3bd15b1
commit
4044ce25ce
4 changed files with 43 additions and 0 deletions
|
|
@ -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),
|
||||
),
|
||||
]
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
9
apps/api/plane/utils/color.py
Normal file
9
apps/api/plane/utils/color.py
Normal file
|
|
@ -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…
Add table
Add a link
Reference in a new issue