0

I'm building a simple quiz app. I want to add an ability to add multiple choices (with custom user text) for each question in the admin panel. So the user can create a question and on the same page add as many answers as he needs. What is the best way to realize it?

I know that I can add another model for answers and make a relationship with questions model. But it's not exactly what I want to achieve.

Thanks for any help.

Alexander Seredenko
  • 799
  • 3
  • 9
  • 26

2 Answers2

0

Emmm. Then what do you want to achieve ?) You've just described the right way to do it.

It was answered here:

  1. django quiz app model for multiple choice questions
  2. https://codereview.stackexchange.com/questions/114962/model-classes-for-a-quiz-app-in-django/115014

If you want, you can check out how it's done in this popular django app: https://github.com/tomwalker/django_quiz/blob/master/multichoice/models.py

Best regards

Igor Belkov
  • 446
  • 3
  • 8
0

I've found the answer in the official Django tutorial (thanks for comments) https://docs.djangoproject.com/en/2.1/intro/tutorial07/

Alexander Seredenko
  • 799
  • 3
  • 9
  • 26