Random color selection from list in django

I have a list of colors in models like:

COLOR_CODE = (
    ('bg1', '#8AD7E0'),
    ('bg2', '#E0BD75'),
    ('bg3', '#EAC2AC'),
    ('bg4', '#C0AFDB'),
    ('bg5', '#96B2E0'),
    ('bg6', '#8BE0B0'),
    ('bg7', '#D2A1E0'),
    ('bg8', '#BCE080'),
)

i need to use them in serializers, how can i do that?

I am very new to django and i tried codes like

''.join([random.choice(chars) for c in range (10)])

the above was for random choice for passwords

Back to Top