Fixing setup.py to reference README instead of README.markdown as otherwise sdist...
[philo.git] / philo / contrib / penfield / admin.py
index c70cf46..d350303 100644 (file)
@@ -2,6 +2,7 @@ from django import forms
 from django.contrib import admin
 from django.core.urlresolvers import reverse
 from django.http import HttpResponseRedirect, QueryDict
 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.contrib.penfield.models import BlogEntry, Blog, BlogView, Newsletter, NewsletterArticle, NewsletterIssue, NewsletterView
 
 from philo.admin import EntityAdmin, AddTagAdmin, COLLAPSE_CLASSES
 from philo.contrib.penfield.models import BlogEntry, Blog, BlogView, Newsletter, NewsletterArticle, NewsletterIssue, NewsletterView
 
@@ -14,16 +15,12 @@ class DelayedDateForm(forms.ModelForm):
                self.fields[self.date_field].required = False
 
 
                self.fields[self.date_field].required = False
 
 
-class TitledAdmin(EntityAdmin):
+class BlogAdmin(EntityAdmin):
        prepopulated_fields = {'slug': ('title',)}
        list_display = ('title', 'slug')
 
 
        prepopulated_fields = {'slug': ('title',)}
        list_display = ('title', 'slug')
 
 
-class BlogAdmin(TitledAdmin):
-       pass
-
-
-class BlogEntryAdmin(TitledAdmin, AddTagAdmin):
+class BlogEntryAdmin(AddTagAdmin):
        form = DelayedDateForm
        filter_horizontal = ['tags']
        list_filter = ['author', 'blog']
        form = DelayedDateForm
        filter_horizontal = ['tags']
        list_filter = ['author', 'blog']
@@ -44,6 +41,7 @@ class BlogEntryAdmin(TitledAdmin, AddTagAdmin):
                })
        )
        related_lookup_fields = {'fk': raw_id_fields}
                })
        )
        related_lookup_fields = {'fk': raw_id_fields}
+       prepopulated_fields = {'slug': ('title',)}
 
 
 class BlogViewAdmin(EntityAdmin):
 
 
 class BlogViewAdmin(EntityAdmin):
@@ -70,11 +68,12 @@ class BlogViewAdmin(EntityAdmin):
        related_lookup_fields = {'fk': raw_id_fields}
 
 
        related_lookup_fields = {'fk': raw_id_fields}
 
 
-class NewsletterAdmin(TitledAdmin):
-       pass
+class NewsletterAdmin(EntityAdmin):
+       prepopulated_fields = {'slug': ('title',)}
+       list_display = ('title', 'slug')
 
 
 
 
-class NewsletterArticleAdmin(TitledAdmin, AddTagAdmin):
+class NewsletterArticleAdmin(AddTagAdmin):
        form = DelayedDateForm
        filter_horizontal = ('tags', 'authors')
        list_filter = ('newsletter',)
        form = DelayedDateForm
        filter_horizontal = ('tags', 'authors')
        list_filter = ('newsletter',)
@@ -94,6 +93,7 @@ class NewsletterArticleAdmin(TitledAdmin, AddTagAdmin):
                })
        )
        actions = ['make_issue']
                })
        )
        actions = ['make_issue']
+       prepopulated_fields = {'slug': ('title',)}
        
        def author_names(self, obj):
                return ', '.join([author.get_full_name() for author in obj.authors.all()])
        
        def author_names(self, obj):
                return ', '.join([author.get_full_name() for author in obj.authors.all()])
@@ -107,8 +107,10 @@ class NewsletterArticleAdmin(TitledAdmin, AddTagAdmin):
        make_issue.short_description = u"Create issue from selected %(verbose_name_plural)s"
 
 
        make_issue.short_description = u"Create issue from selected %(verbose_name_plural)s"
 
 
-class NewsletterIssueAdmin(TitledAdmin):
-       filter_horizontal = TitledAdmin.filter_horizontal + ('articles',)
+class NewsletterIssueAdmin(EntityAdmin):
+       filter_horizontal = ('articles',)
+       prepopulated_fields = {'slug': ('title',)}
+       list_display = ('title', 'slug')
 
 
 class NewsletterViewAdmin(EntityAdmin):
 
 
 class NewsletterViewAdmin(EntityAdmin):