Here is a django model:
class Question(models.Model):
text = models.TextField(verbose_name=u'Вопрос')
is_free_text = models.BooleanField(verbose_name=u'Ответ в виде текста?')
options = models.ManyToManyField('QuestionOption', related_name='option',null=True, blank=True)
and options model it uses:
class QuestionOption(models.Model):
text = models.TextField(verbose_name=u'Вариант ответа')
score = models.IntegerField()
Django admin, when you attempt to add a new Question will show you a form where you can enter question text, tick the is_free_text checkbox and a listbox with existing options and a plus icons to let you add new ones.
Is there a way to disable this behaviour and force users to always add new options instead of being able to as well select the existing ones? Ideally, I don't want them to see existing options as this is sometimes confusing. Like a line of text and a text box for score and a plus icon to add a new record of option text and its score?
I'm trying to utilize existing django admin as much as possible and I think I saw this done exactly the way I'm trying to express here but can't remember where.
As I understand your question, you should use
InlineModelAdmin
: