[Fixed]-Disable pylint warning E1101 when using enums

2👍

Since the issue is still open, we can use the following workaround

from .utils import ChoiceEnum

class Car(models.Model):
    class Colors(ChoiceEnum, Enum):
        RED = 'red'
        WHITE = 'white'
        BLUE = 'blue'

    color = models.CharField(max_length=5, choices=Colors.choices(), default=Colors.RED.value)

This doesn’t create the pylint error now

👤newbie

Leave a comment