How Django's inlineformset work? What is the concept behind the hidden id field?
I've three models
class QuestionSet(models.Model):
title = models.CharField(max_length=255)
class Question(models.Model):
question_set = models.ForeignKey(QuestionSet)
question = models.TextField(blank=False)
class Answer(models.Model):
question = models.ForeignKey(Question)
text = models.CharField(max_length=500)
is_correct = models.BooleanField(default=False)
I would like to create a page with form, where there is one field for QuestionSet, multiple Question fields and each question has field for many answer fields. The questions and answers initial extra can be 4 but should be extendable via javascript. Say a + button to add one more option to a question. And another + button to add one more option to add a new question with default 4 answer fields.
I've read and understood Dynamically adding a form to a Django formset with Ajax. I need the same feature for nested inline formset.