I have followed http://neutronx.github.io/django-markdownx/js/docs/markdownx.html#MarkdownX docs but can't get it done properly.
What is the correct way to setup two or more editors in the same page?
You don't have to set it up that way. MarkdownX is already initiated as your load {{form}}
and {{form.media}}
, so it has no meaning. Now, coming to your question. Using two editors on the same page in really straight forward.
in your forms.py
:
from django import forms
from markdownx.fields import MarkdownxFormField
class FirstForm(forms.Form):
yourfirstfield = MarkdownxFormField()
class SecondForm(forms.Form):
yoursecondfield = MarkdownxFormField()
in your views.py
:
from django.shortcuts import render
from .forms import FirstForm, SecondForm
def form_view(request):
context = {
'first_form': FirstForm,
'second_form': SecondForm
}
return render(request, 'form_template.html', context)
in your form_template.html
:
<form>
<p>{{first_form}}</p>
<p>{{second_form}}</p>
</form>
I hope that helps!