Monday, April 30, 2012

Dojo Rich Editor Implementation in Admin.py

Hi All,

I'm building a blog, with models "Post" and "Image" (each blog post can have multiple images; they're related by ForeignKey) and I'm trying to implement the Dojo rich editor in my admin site by following the example here:

https://gist.github.com/868595

However, the rich editor is not showing up.  I have a feeling I don't have something set up correctly in my admin.py file; could anyone tell me what it is?  Here are the contents of admin.py:

from blogs.models import Post,Image
from django.contrib import admin
from django.contrib.admin import site, ModelAdmin
import models


class CommonMedia:
  js = (
    'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
    '/home/guillaume/mysite/blogs/static/editor.js',
  )
  css = {
    'all': ('/home/guillaume/mysite/blogs/static/editor.css',),
  }

class PostImageInline(admin.TabularInline):
    model = Image
    extra = 5

class PostAdmin(admin.ModelAdmin):
    inlines = [PostImageInline]

site.register(models.Post,
    list_display = ('text',),
    search_fields = ['text',],
    Media = CommonMedia,
)

admin.site.unregister(Post)

admin.site.register(Post, PostAdmin)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/IPDPAY_Z5skJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment