padmatexts/padmaTexts/texts/admin.py
2011-02-21 10:14:16 +00:00

19 lines
652 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',)}
list_display = ['title', 'author', 'date']
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)