Coverage for posts/admin.py: 100.00%
19 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-05-02 19:56 -0700
« prev ^ index » next coverage.py v7.8.0, created at 2025-05-02 19:56 -0700
1from django.contrib import admin
3from .models import Comment, Post
6class CommentInline(admin.TabularInline):
7 model = Comment
10@admin.register(Post)
11class PostAdmin(admin.ModelAdmin):
12 list_display = ["title", "slug", "author", "publish", "status"]
13 list_filter = ["status", "created", "publish", "author"]
14 search_fields = ["title", "body"]
15 prepopulated_fields = {"slug": ("title",)}
16 raw_id_fields = ["author"]
17 date_hierarchy = "publish"
18 ordering = ["status", "publish"]
19 inlines = [
20 CommentInline,
21 ]
24@admin.register(Comment)
25class CommentAdmin(admin.ModelAdmin):
26 list_display = ["name", "email", "post", "created", "active"]
27 list_filter = ["active", "created", "updated"]
28 search_fields = ["name", "email", "body"]