How to set django-wysiwyg to the field in inline formset? -


i have inline formset. , use django-wysiwyg set wysiwyg editor on fields.
when page loaded, works perfectly. use {% wysiwyg_editor form.worktime.auto_id %} set editor on field.
when dynamicaly add 1 more form inlineformset, there no editor showing up.
here form:

class commentform(forms.modelform):      class meta:         model = comment         fields = '__all__'  institutiondoctorsfromset = inlineformset_factory(institution, doctor, fields='__all__', extra=1) 

and template:

  <form class="the_form" enctype="multipart/form-data" method="post">         {% csrf_token %}         {{ form.as_p }}         {% wysiwyg_editor "id_services" %}         <fieldset>             <legend>doctors:</legend>             {{ doctor_form.management_form }}             {% form in doctor_form %}                 {{ form.id }}                 <div class="inline {{ doctor_form.prefix }}">                     {{ form.as_p }}                     {% wysiwyg_editor form.worktime.auto_id  %}                 </div>             {% endfor %}         </fieldset>         <input class="btn btn-default" type="submit" name="submit" value="update"/>     </form> 

if run following js code in browser console - editor appears: django_wysiwyg.enable('ckeditor', 'id_doctor_set-3-regime'), id_doctor_set-3-regime id of field, need have editor. there can many fields, need more flexible solution.
think need implement when formset loaded, or catch event when subform added, don't know how.

change: {% wysiwyg_editor "id_services" %} on: {% wysiwyg_editor "id_doctors" %}


Comments