Version 1 (modified by 18 years ago) ( diff ) | ,
---|
Download Dojo (kitchen sink) and save it as /media/dojo/...
Save the following script as AddRichTextEditing.js into /media/js/admin/
document.write('<script type="text/javascript" src="/media/dojo/dojo.js"></script>'); document.write('<script type="text/javascript">dojo.require("dojo.widget.Editor2");</script>'); var AddEditor = { init: function() { var helptext = document.getElementsByTagName('p'); for (var i = 0, ht; ht = helptext[i]; i++) { if (ht.firstChild.data == "Rich Text Editing.") { ht.previousSibling.previousSibling.setAttribute("dojoType", "Editor2"); } } }, } addEvent(window, 'load', AddEditor.init);
This script looks for the help text "Rich Text Editing." and replaces the textarea before with the Dojo-Editor.
Define your model like this:
body = models.TextField('Body', help_text='Rich Text Editing.', blank=True, null=True) ... class Admin: js = ['js/admin/AddRichTextEditing.js']
that´s it.
result could look like
Note:
See TracWiki
for help on using the wiki.