tags:

views:

13

answers:

0

Hey guys, i try to integrate xinha with my django app. I writed own panel admin, and i need to use xinha editor in one textarea. So:

xinha widget.py

class Xinha(forms.Textarea):
  class Media:
            js = ('/media/v/1/xinha/init.js',
                  '/media/v/1/xinha/XinhaCore.js'                
                  '/media/v/1/xinha/config.js',)

  def __init__(self, language=None, attrs=None):
            self.language = language or settings.LANGUAGE_CODE[:2]
            self.attrs = {'class': 'xinha'}
            if attrs: self.attrs.update(attrs)
            super(Xinha, self).__init__(attrs)

  def render(self, name, value, attrs=None):
            rendered = super(Xinha, self).render(name, value, attrs)
            return rendered 

forms.py

class ArticleForm(ModelForm):
  content = forms.CharField(widget=Xinha())

  class Meta:
    model = Article

And it just dont load, but the label changes from typed in realated_name to name of the model field. So something is happening.

I need xinha because I already did some modifications to it. Thanks for quick reply.