28 lines
978 B
Python
28 lines
978 B
Python
from django.contrib import admin
|
|
|
|
from .models import Article, NewsSource, Topic
|
|
|
|
|
|
@admin.register(Topic)
|
|
class TopicAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'accent_color')
|
|
search_fields = ('name', 'description')
|
|
prepopulated_fields = {'slug': ('name',)}
|
|
|
|
|
|
@admin.register(NewsSource)
|
|
class NewsSourceAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'is_active', 'last_synced_at')
|
|
list_filter = ('is_active',)
|
|
search_fields = ('name', 'feed_url', 'description')
|
|
prepopulated_fields = {'slug': ('name',)}
|
|
|
|
|
|
@admin.register(Article)
|
|
class ArticleAdmin(admin.ModelAdmin):
|
|
list_display = ('title', 'article_kind', 'topic', 'source', 'is_featured', 'is_published', 'published_at')
|
|
list_filter = ('article_kind', 'topic', 'is_featured', 'is_published', 'source')
|
|
search_fields = ('title', 'excerpt', 'content', 'author_name', 'external_url')
|
|
prepopulated_fields = {'slug': ('title',)}
|
|
autocomplete_fields = ('topic', 'source')
|