Defining choices outside of model producess fields.E005 error

I have the following code in my models.py:

from django.db import models
from django.utils.translation import gettext_lazy as _

class Sport(models.IntegerChoices):
    SWIMMING = 0, _("Swimming")
    HIKING = 1, _("Hiking")
    RUNNING = 2, _("Running")

class Manufacturer(models.Model):
    uuid = models.UUIDField(default=uuid4, editable=False)
    name = models.CharField(
        max_length=255,
        help_text="Manufacturer name as displayed on their website",
    )
    url = models.URLField(blank=True)
    sport = models.PositiveSmallIntegerField(choices=Sport)

class OrganisationClass(models.Model):
    uuid = models.UUIDField(default=uuid4, editable=False)
    class_name = models.CharField(max_length=64, blank=False)
    description = models.CharField(
        max_length=255,
        blank=False,
    )
    sport = models.PositiveSmallIntegerField(choices=Sport)

which produces the FAIClass.sport: (fields.E005) 'choices' must be an iterable containing (actual value, human readable name) tuples. when I run manage.py check and I don't understand why. I got the idea to do it based on this answer, I'd really appreciate if someone could help.

Back to Top