Hi all,

I'm trying to create a custom field which will automatically include
some required JavaScript libraries in the admin interface, without
having to modify contrib.admin. Currently I have a custom model field
defined as follows:

class RichTextField(models.TextField):
    "A rich text editor field which provides a WYSIWYG editor
component."
    def contribute_to_class(self, cls, name):
        # Automatically add TinyMCE JavaScript libraries.
        opts = cls._meta
        opts.admin.js.append('js/tiny_mce/tiny_mce.js')
        opts.admin.js.append('js/tiny_mce/textareas.js')

    def get_manipulator_field_objs(self):
        return [common_forms.RichTextField]

My idea was to have the field automatically append the required
JavaScript libs to the model AdminOptions js list so this would handle
everything for me, but I seem to be having some issues. I get the
following exception:

'NoneType' object has no attribute 'js'

on the first append() line, but if I do a trace print on opts.admin.js
it gives me the contents of the js list as defined in the model admin
opts, and reports it is of type list. I'm not sure why it won't let me
modify the list - and what's even weirder is I swear it was working for
me before and I'm not sure what I've done to break it.

I'm still looking into this but would appreciate any suggestions.

Cheers,

Nick


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to