I got sick of TinyMCE and switched to jQuery wysiwyg sorry this is just posted raw like this, but here it is. I should wrap it up on github.
requires http://code.google.com/p/jwysiwyg/ and the 3 files stated below to be in your compress stack or on your page from django import forms from django.utils.safestring import mark_safe import simplejson as json # requires # 'shared/js/jquery.wysiwyg.js', # 'shared/css/jquery.wysiwyg.css', # 'shared/css/jquery.wysiwyg.modal.css', class JWYSIWYGFormField(forms.fields.Field): def __init__(self, cols=80,rows=10,params=None,*args, **kwargs): self.widget = JWYSIWYGWidget(cols=cols,rows=rows,params=params) super(JWYSIWYGFormField, self).__init__(*args, **kwargs) class JWYSIWYGWidget(forms.TextInput): def __init__(self, cols,rows,params=None,attrs=None): final_attrs = {'cols':cols,'rows':rows} if attrs: final_attrs.update(attrs) self.params = params super(JWYSIWYGWidget,self).__init__(attrs=final_attrs) def render(self, name, value, attrs=None): # attrs is for the form field subs = {} subs['id'] = "id_" + name subs['name'] = name if value is not None: subs['value'] = value else: subs['value'] = "" subs['cols'] = attrs.get('cols',self.attrs['cols']) subs['rows'] = attrs.get('rows',self.attrs['rows']) # no separators yet # button_rows = [BUTTON_PALETTE[group] for group in self.attrs['button_groups']] params = {} defaults = dict( strikeThrough= True, underline = True, separator00= False, justifyLeft = True, justifyCenter= True, justifyRight = False, justifyFull = False, separator01= False, indent = True, outdent= True, separator02= False, subscript = False, superscript= False, separator03= False, undo= False, redo= False, separator04= False, resizeOptions = {}, insertOrderedList = False, insertUnorderedList = True, insertHorizontalRule= False, h1 = False, h2 = False, h3 = True, table = False, separator07= False, cut = False, copy = False, paste= False) defaults.update(self.params or {}) for p,v in defaults.iteritems(): if type(v) == bool: params[p] = { 'visible': v } else: params[p] = v subs['params'] = json.dumps({'controls':params}) subs['button'] = "<input type='button' id='edit_html_%s' value='Edit HTML' />" % subs['id'] subs['button_code'] = """$('#edit_html_% (id)s').click(function(){$(this).hide();$('#%(id)s').slideDown();}); $('#%(id)s').blur(function(){$(this).wysiwyg('setContent',$ (this).val())}); """ % {'id':subs['id']} template = u"""<textarea id="%(id)s" name="%(name)s" cols="% (cols)s" rows="%(rows)s">%(value)s</textarea><script type="text/ javascript">$(function(){ $('#%(id)s').wysiwyg(%(params)s);% (button_code)s});</script>%(button)s""" return mark_safe(template % subs) On Sep 21, 5:41 pm, Sithembewena Lloyd Dube <zebr...@gmail.com> wrote: > Hi, > > Has anybody intergrated a WYSIWYG editor in the admin of a Django 1.2.1. > site? I have tried django-wysiwyg and TinyMCE to no avail. I need something > with concise, up-to-date documentation. > > If anybody has done this, please recommend and also point to the docs? > > Thanks. > > -- > Regards, > Sithembewena Lloyd Dubehttp://www.lloyddube.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.