X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/cc6dbd55a2af538657c288a709662b9c84949854..5c919ea0dec366d8d78fee8944577c454f335b2a:/philo/contrib/penfield/admin.py diff --git a/philo/contrib/penfield/admin.py b/philo/contrib/penfield/admin.py index d350303..31aacb1 100644 --- a/philo/contrib/penfield/admin.py +++ b/philo/contrib/penfield/admin.py @@ -3,8 +3,10 @@ from django.contrib import admin from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect, QueryDict -from philo.admin import EntityAdmin, AddTagAdmin, COLLAPSE_CLASSES +from philo.admin import EntityAdmin, COLLAPSE_CLASSES +from philo.admin.widgets import EmbedWidget from philo.contrib.penfield.models import BlogEntry, Blog, BlogView, Newsletter, NewsletterArticle, NewsletterIssue, NewsletterView +from philo.models.fields import TemplateField class DelayedDateForm(forms.ModelForm): @@ -20,9 +22,8 @@ class BlogAdmin(EntityAdmin): list_display = ('title', 'slug') -class BlogEntryAdmin(AddTagAdmin): +class BlogEntryAdmin(EntityAdmin): form = DelayedDateForm - filter_horizontal = ['tags'] list_filter = ['author', 'blog'] date_hierarchy = 'date' search_fields = ('content',) @@ -42,6 +43,9 @@ class BlogEntryAdmin(AddTagAdmin): ) related_lookup_fields = {'fk': raw_id_fields} prepopulated_fields = {'slug': ('title',)} + formfield_overrides = { + TemplateField: {'widget': EmbedWidget} + } class BlogViewAdmin(EntityAdmin): @@ -73,9 +77,9 @@ class NewsletterAdmin(EntityAdmin): list_display = ('title', 'slug') -class NewsletterArticleAdmin(AddTagAdmin): +class NewsletterArticleAdmin(EntityAdmin): form = DelayedDateForm - filter_horizontal = ('tags', 'authors') + filter_horizontal = ('authors',) list_filter = ('newsletter',) date_hierarchy = 'date' search_fields = ('title', 'authors__name',) @@ -94,6 +98,9 @@ class NewsletterArticleAdmin(AddTagAdmin): ) actions = ['make_issue'] prepopulated_fields = {'slug': ('title',)} + formfield_overrides = { + TemplateField: {'widget': EmbedWidget} + } def author_names(self, obj): return ', '.join([author.get_full_name() for author in obj.authors.all()])