I have two simple models Question and Choice (one question has multiple choices). I have used inline formset to add Choices along with adding Questions (through modelAdmin functionality).
class Question(models.Model):
category = models.CharField(max_length=50)
question_text = RichTextField(max_length=2000, verbose_name="Question Text", blank=True)
class Choice(models.Model):
question = models.ForeignKey(Question)
description = RichTextField(max_length=500, verbose_name="Choice Description")
is_correct = models.BooleanField(default=False)
Now the fields of Choice and Question are RichTextField defined in django-ckeditor. The issue is when I click on "Add another choice" I get an uncaught exception: [CKEDITOR.editor] The instance "id_choice_set-__prefix__-description" already exists
, which disrupts the ckeditor functionality.
Any ideas/suggestions how to fix this issue? I think some JS tweaks can help but I have a very limited knowledge in JS/Jquery
Thanks