+class NewsletterArticleAdmin(TitledAdmin, AddTagAdmin):
+ form = DelayedDateForm
+ filter_horizontal = ('tags', 'authors')
+ list_filter = ('newsletter',)
+ date_hierarchy = 'date'
+ search_fields = ('title', 'authors__name',)
+ list_display = ['title', 'date', 'author_names']
+ fieldsets = (
+ (None, {
+ 'fields': ('title', 'authors', 'newsletter')
+ }),
+ ('Content', {
+ 'fields': ('full_text', 'lede', 'tags')
+ }),
+ ('Advanced', {
+ 'fields': ('slug', 'date'),
+ 'classes': COLLAPSE_CLASSES
+ })
+ )
+
+ def author_names(self, obj):
+ return ', '.join([author.get_full_name() for author in obj.authors.all()])
+ author_names.short_description = "Authors"
+
+
+class NewsletterIssueAdmin(TitledAdmin):
+ filter_horizontal = TitledAdmin.filter_horizontal + ('articles',)
+
+
+class NewsletterViewAdmin(EntityAdmin):
+ fieldsets = (
+ (None, {
+ 'fields': ('newsletter',)
+ }),
+ ('Pages', {
+ 'fields': ('index_page', 'article_page', 'issue_page')
+ }),
+ ('Archive Pages', {
+ 'fields': ('article_archive_page', 'issue_archive_page')
+ }),
+ ('Permalinks', {
+ 'fields': ('article_permalink_style', 'article_permalink_base', 'issue_permalink_base'),
+ 'classes': COLLAPSE_CLASSES
+ }),
+ ('Feeds', {
+ 'fields': ('feed_suffix', 'feeds_enabled'),
+ 'classes': COLLAPSE_CLASSES
+ })
+ )
+ raw_id_fields = ('index_page', 'article_page', 'issue_page', 'article_archive_page', 'issue_archive_page',)
+
+