Saturday, November 20, 2021

choices = django background color

Mudar condicionalmente a cor de fundo da célula no django admin

Olá Preciso retornar uma lista de opcões do mysql, cada uma com uma cor. 


models.py

STATUS_CHOICES = (
        ('Pendente', format_html('<span><style="background-color:#ffcccc">Pendente</span>')),
        ('AGuardando', format_html('<span><style="background-color:#aaffcc">Aguardando</span>')),
        ('Resolvido', format_html('<span><style="background-color:#dddddd">Resolvido</span>')),
    )
status = models.CharField(max_length=10, choices=STATUS_CHOICES, blank=False, null=False)


Alguém pode me ajudar?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ec931086-d720-49db-89ea-7de06f3622e0n%40googlegroups.com.

No comments:

Post a Comment