<div id="div_id_message" class="field-wrapper mb-3">
<label for="id_message" class="label-class block text-gray-900 text-sm mb-2">
Message<span class="asteriskField">*</span>
</label>
<div data-controller="quill-editor"
class=" " required id="id_message"
>
<div id="id_message" data-quill-editor-target="editor"></div>
<input id="input-id_message" name="message"
data-quill-editor-target="input" type="hidden" >
<div data-quill-editor-target="message"></div>
</div>
</div>
def richtext_editor(self, **kwargs):
class TestForm(forms.Form):
# We can pass extra attributes to enable some features
# from django.urls import reverse
#
# message = forms.CharField(
# widget=HammerRichTextWidget(attrs={
# 'data-quill-editor-upload-url-value': reverse('api-core:upload_image'),
# 'data-quill-editor-mention-url-value': reverse('api-core:mention_query'),
# }),
# )
message = forms.CharField(
widget=HammerRichTextWidget(),
)
form = TestForm()
template = Template(
"""
{% load formify %}
{% render_field form.message %}
""",
)
return template.render(Context({"form": form}))