[Answered ]-'choices' must be an iterable containing (actual value, human readable name) tuples django 3.1

1👍

The choices=… should be provided the outcome of the .choices property of your TypeOfUser and AllowdToTakeAppointment:

class User(AbstractUser):
    type_of_user = models.CharField(
        max_length=200,
        #            .choices ↓
        choices=TypeOfUser.choices,
        default=TypeOfUser.PATIENT
    )
    allowd_to_take_appointement = models.CharField(
        max_length=20,
        #                          .choices ↓
        choices=AllowdToTakeAppointement.choices,
        default=AllowdToTakeAppointement.YES
    )

    def is_doctor(self):
        return self.type_of_user == TypeOfUser.DOCTOR

    def can_add_appointment(self):
        return self.type_of_user == AllowdToTakeAppointement.YES

Leave a comment