from django.contrib import admin from .models import Topic, Entry, Book from utils.widgets import LGEntryForm class TopicAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ('name',), "pluralized_name": ('name',)} class BookAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ('title', )} list_display = ('title', 'pub_date', 'status') fieldsets = ( ('Entry', { 'fields': ( 'title', 'body_markdown', 'image', ('pub_date', 'status'), ('price', 'price_sale'), 'meta_description', ('slug', 'template_name', 'pages'), ), 'classes': ( 'show', 'extrapretty', 'wide' ) } ), ) class EntryAdmin(admin.ModelAdmin): form = LGEntryForm list_display = ('title', 'pub_date', 'enable_comments', 'status') list_filter = ('pub_date', 'enable_comments', 'status') prepopulated_fields = {"slug": ('title',)} fieldsets = ( ('Entry', { 'fields': ( 'title', 'body_markdown', ('pub_date', 'status'), 'topics', 'meta_description', ('slug', 'enable_comments', 'has_code', 'template_name'), ), 'classes': ( 'show', 'extrapretty', 'wide' ) } ), ) admin.site.register(Book, BookAdmin) admin.site.register(Topic, TopicAdmin) admin.site.register(Entry, EntryAdmin)