1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] (fields.E005) 'choices' must be an iterable containing (actual value, human readable...

Discussão em 'Python' iniciado por Stack, Outubro 6, 2024 às 21:32.

  1. Stack

    Stack Membro Participativo

    I created this model below and I was working fine for almost the whole week. Closed the server and restarted it again and it threw me the (fields.E005) 'choices' must be an iterable containing (actual value, human readable name) tuples error. Used django documentation exactly, still no solution.

    `class Inspection(models.Model):

    RESULT_CHOICES = [
    ("PR" "Passed"),
    ("PR" "Passed with minor Defects"),
    ("PR" "Passed with major Defects"),
    ("FR" "Failed due to minor Defects"),
    ("FR" "Failed due to major Defects"),
    ("FR" "Failed"),
    ]

    vin_number = models.ForeignKey(Vin, on_delete=models.CASCADE, related_name='inspections')
    inspection_number = models.CharField(max_length=20)
    year = models.CharField(max_length=4)
    inspection_result = models.CharField(max_length=30,
    choices=RESULT_CHOICES)
    ag_rating = models.CharField(max_length=30)
    inspection_date = models.DateField()
    link_to_results = models.CharField(max_length=200)

    def __str__(self):
    return self.inspection_number`


    I tried to: YEAR_IN_SCHOOL_CHOICES = { "FR": "Freshman", "SO": "Sophomore", "JR": "Junior", "SR": "Senior", "GR": "Graduate", }

    but still didn't work. Can even migrate due to the error

    Continue reading...

Compartilhe esta Página