views:

84

answers:

0

I'm using django-cms 2.1 and have a problem with rendering a form for a model that contains PlaceholderField:

The article model is nothing unusual except it has:

sidebar = PlaceholderField('sidebar', related_name="news_sidebar")

Then I set wymeditor widget for html fields:

class NewsArticleAdminModelForm(forms.ModelForm):
    body = forms.CharField(widget=WYMEditor())
    teaser_body = forms.CharField(widget=WYMEditor())

    class Meta:
        model = get_model('news', 'newsarticle')

And use it in admin class:

class NewsArticleAdmin(admin.ModelAdmin):
    form = NewsArticleAdminModelForm
    list_display = ('teaser_title', 'order', 'created', 'modified')
    list_editable = ('order',)
    fieldsets = (
        ('Teaser', {
            'fields': ('teaser_title', 'teaser_body',),
        }),
        ('News Article', {
            'fields': (('title', 'sub_title',), ('slug', 'order'), 'body'),
        }),
        ('Sidebar', {
            'fields': ('sidebar',),
        }),
    )
    prepopulated_fields = {"slug": ("title",)}

    class Media:
        js = ('/media/admin_custom/js/jquery.min.js',)


admin.site.register(NewsArticle, PlaceholderAdmin)

Wymeditor worked fine when I used admin.site.register(NewsArticle, NewsArticleAdmin) but when I've changed it to admin.site.register(NewsArticle, PlaceholderAdmin) (to render placeholder part of form) WYMEditor no longer shows up.

Firebug says nothing.