Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pagedown(markdown editor) with Django

I trying to use the pagedown(markdown editor), the one that stackoverflow in my django based website. However to get the markdown editor in a textarea it is required to give the text area both id and class as

<textarea id="wmd-input" class="wmd-input"/>

However the form fields generated by django have a default id as id_<field-name>. Is there a way I can assign the same id to this text_area?

like image 417
Sachin Avatar asked Dec 10 '11 21:12

Sachin


1 Answers

you can directly pass id as well in the models.py where your are passing class name. This will override the default behavior.

widgets = {
        '<attribute_name>': Textarea(attrs={'class':'wmd-input','id':'wmd-input'}),
            }
like image 182
G Gill Avatar answered Sep 22 '22 01:09

G Gill