I find myself stuck in dealing with Django models choice fields and react select options. May someone kindly help. This is my models code:
class AccountType(models.Model):
category = models.SmallIntegerField(
choices=(
(AccountCategories.ASSET, "Asset"),
(AccountCategories.LIABILITY, "Liability"),
(AccountCategories.EQUITY, "Equity"),
(AccountCategories.REVENUE, "Revenue"),
(AccountCategories.EXPENSE, "Operating Expense"),
)
)
classification = models.SmallIntegerField(
choices=(
(AccountClassifications.NONE, ""),
(AccountClassifications.CURRENT, "Current"),
(AccountClassifications.NONCURRENT, "Long-Term"),
)
)
I cant seem to figure out on how to make these choices to be my select options in React form. Was thinking maybe the solution may be in validating or cleaning these choices in my serializers but I am stuck on the how especially on linking with a React Form. Thanks in advance