I want to create this kind of API Django:
{
question_no: "1",
question: "How many sides are equal in a scalene triangle?",
options: [
{ answer_options: "3", selected: false, isCorrect: true },
{ answer_options: "2", selected: false, isCorrect: false},
{ answer_options: "0", selected: false, isCorrect: false},
{ answer_options: "1", selected: false, isCorrect: false},
],
},
but I don't know how can I add the options array in my API in the Django rest framework.
this is the model that I have created so far but it only contains question_no and question:
class quiz(models.Model):
question_no = models.IntegerField()
question = models.CharField(max_length=400)
how can I add the options array in my model?