padmatexts/padmaTexts/texts/admin.py

19 lines
652 B
Python
Raw Normal View History

2010-11-11 00:16:21 +00:00
from models import PadmaText
from django.contrib import admin
from django import forms
from django.db import models
2010-11-14 14:46:34 +00:00
#refer: http://johansdevblog.blogspot.com/2009/10/adding-ckeditor-to-django-admin.html
2010-11-11 00:16:21 +00:00
class PadmaTextAdmin(admin.ModelAdmin):
2010-11-14 14:46:34 +00:00
formfield_overrides = {models.TextField: {'widget':forms.Textarea(attrs={'class':'ckeditor'})}, }
2010-11-11 00:16:21 +00:00
prepopulated_fields = {'slug': ('title',)}
2011-02-21 10:14:16 +00:00
list_display = ['title', 'author', 'date']
2010-11-11 00:16:21 +00:00
class Media:
js = ('ckeditor/ckeditor.js',) # The , at the end of this list IS important.
2010-11-14 14:46:34 +00:00
css = {
'all': ('/static/css/admin_textarea.css',)
}
2010-11-11 00:16:21 +00:00
admin.site.register(PadmaText,PadmaTextAdmin)