I'm trying to get the options under APPRAISAL_TYPE to show up on my React form
class Appraisal(BaseModel): class APPRAISAL_TYPE(models.IntegerChoices): self_appraisal = 1 line_manager = 2 coo = 3 name = models.CharField(max_length=200, blank=True) category = models.IntegerField(choices=APPRAISAL_TYPE.choices, default=APPRAISAL_TYPE.self_appraisal) description = models.TextField(max_length=200, blank=True) appraisal_for = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL, related_name="re_appraisal_for") appraised_by = models.CharField(max_length=200, blank=True)
<InputGroup> <InputLeftAddon children="Category" borderRadius="16px" /> <Select name="category" value={APPRAISAL_TYPE[appraisalDetails.status]} options={categoryOptions} onChange={(option) => handleChange(option, "category")} /> </InputGroup>
However, since category is an integer field, it should be concatenated with APPRAISAL_TYPE, so I get an error expecting an integer.
You can try this
What type of
Select
component is used, the properties of categoryOptions need to be changed accordinglyHope this can help you solve your problem.