I have this subset object (a list of dictionnary).
quiz = [
{'question': 'Cassandra',
'response': 'relationnelles',
},
{'question': 'MongoDB et CouchDB',
'response': 'oriented objet,
},
]
my_question = tuple(q['question'] for q in quiz)
Here is the model
class Quiz(BaseModel):
question: Literal[my_question]
response: str
@api.post("/postdata")
def post_data(form_data: Quiz = Depends()):
data.append(form_data)
return data
I would like to get the response automatically linked when I select the question item. The idea is to got the answer of the selected question dynamically Here is the actual output I got.