Fix bug/enhancement #210: Generate a random hex color for a new users
parent
6af88277e6
commit
93035ca646
|
@ -8,9 +8,15 @@ from django.contrib.auth.models import UserManager, AbstractUser
|
|||
from taiga.base.utils.slug import slugify_uniquely
|
||||
from taiga.base.notifications.models import WatcherMixin
|
||||
|
||||
import random
|
||||
|
||||
|
||||
def generate_random_hex_color():
|
||||
return "#{:06x}".format(random.randint(0,0xFFFFFF))
|
||||
|
||||
|
||||
class User(AbstractUser, WatcherMixin):
|
||||
color = models.CharField(max_length=9, null=False, blank=True, default="#669933",
|
||||
color = models.CharField(max_length=9, null=False, blank=True, default=generate_random_hex_color,
|
||||
verbose_name=_("color"))
|
||||
description = models.TextField(null=False, blank=True,
|
||||
verbose_name=_("description"))
|
||||
|
|
Loading…
Reference in New Issue