[Answer]-Django admin tinymce for part of textareas

1👍

By setting the mode to textareas, it won’t give you any sort of selector control as to which one it applies the editor to. You’ll most likely need to drop the mode setting and go with selector: http://www.tinymce.com/wiki.php/Configuration:selector

The django-tinymce config options are just a mirror for TinyMCE’s settings.

0👍

On a field by field basis you can use this technique providing a custom ModelForm:

class XAdminForm(forms.ModelForm):
    name = forms.CharField(label='Name', max_length=100,
                    widget=forms.TextInput(attrs={'size': '100'}))
    something = forms.CharField(label='Something', max_length=SOME_MAX_LENGTH,
                      widget=forms.Textarea(attrs={'rows': '10', 'cols': '100'}))
    note = forms.CharField(label='Note', max_length=NOTE_MAX_LENGTH,
                   widget=forms.Textarea(attrs={'class': 'ckeditor'}))
class Meta:
    model = x

class Meta:
    model = x


class XAdmin(admin.ModelAdmin):
    model = X
    form = XAdminForm

    class Media:
        js = ('/static/js/ckeditor/ckeditor.js',)
admin.site.register(X, XAdmin)

Leave a comment