[Django]-Text choices attribute not recognised

4👍

Which version of Django do you use?

models.TextChoices is new in Django 3.0

New in Django 3.0: The TextChoices, IntegerChoices, and Choices
classes were added.

https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.Field.choices

Your error has nothing to do with “django-multiselectfield-0.1.10”

You can also define your choices as:

MOVIE_GENGRE = (
    ('action', 'Action'),
    ('horror', 'Horror'),
    ('comedy', 'Comedy'),
)
👤NKSM

0👍

TextChoices work only in Django 3.x, try to update your packadge

pip3 install django==3.0

or later version

Leave a comment