mirror of
https://github.com/Hopiu/django-markdownx.git
synced 2026-03-16 21:40:24 +00:00
Update widgets.py
How about adding those extra variables to the widgets context? This would give some extra flexibility in rendering the template. For example bootstrap tabs:
```
<!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#edit-{{attrs.id}}" role="tab">Edit</a> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#preview-{{attrs.id}}" role="tab">Preview</a> </li> </ul> <!-- Tab panes --> <div class="tab-content markdownx"> <div class="tab-pane active" id="edit-{{attrs.id}}" role="tabpanel"> {{ markdownx_editor }} </div> <div class="tab-pane" id="preview-{{attrs.id}}" role="tabpanel"> <div class="markdownx-preview"></div> </div> </div>
```
This commit is contained in:
parent
af002f3d59
commit
2ee243ec87
1 changed files with 3 additions and 0 deletions
|
|
@ -71,6 +71,9 @@ class MarkdownxWidget(forms.Textarea):
|
|||
|
||||
return template.render({
|
||||
'markdownx_editor': widget,
|
||||
'name': name,
|
||||
'value': value,
|
||||
'attrs': attrs,
|
||||
})
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
Loading…
Reference in a new issue