padmatexts/padmaTexts/texts/admin.py
2010-11-14 20:16:34 +05:30

18 lines
607 B
Python

from models import PadmaText
from django.contrib import admin
from django import forms
from django.db import models
#refer: http://johansdevblog.blogspot.com/2009/10/adding-ckeditor-to-django-admin.html
class PadmaTextAdmin(admin.ModelAdmin):
formfield_overrides = {models.TextField: {'widget':forms.Textarea(attrs={'class':'ckeditor'})}, }
prepopulated_fields = {'slug': ('title',)}
class Media:
js = ('ckeditor/ckeditor.js',) # The , at the end of this list IS important.
css = {
'all': ('/static/css/admin_textarea.css',)
}
admin.site.register(PadmaText,PadmaTextAdmin)