I am trying to build a multiple choice quizzes Django app. I have a model named Answer
, and another model named Question
.
Here are the contents of Answer
:
class Answer(models.Model):
text = models.CharField(max_length=255)
and this is Question
:
class Question(models.Model):
text = models.CharField(max_length=255)
correct_answer = models.ForeignKey('Answer', on_delete=models.CASCADE, related_name='correct_answers')
other_answers = models.ManyToManyField('Answer')
I want to limit the number of choices of other_answers
in django-admin
to 3 answers only. How to do that?
Notes:
- I am ok with re-modeling my models.
- I will not use
django-forms
, I am only building an API for a mobile app.