Coverage for posts/admin.py: 100.00%

19 statements  

« prev     ^ index     » next       coverage.py v7.16.1, created at 2026-09-22 12:02 -0700

1from django.contrib import admin 1a

2 

3from .models import Comment, Post 1a

4 

5 

6class CommentInline(admin.TabularInline): 1a

7 model = Comment 1a

8 

9 

10@admin.register(Post) 1a

11class PostAdmin(admin.ModelAdmin): 1a

12 list_display = ["title", "slug", "author", "publish", "status"] 1a

13 list_filter = ["status", "created", "publish", "author"] 1a

14 search_fields = ["title", "body"] 1a

15 prepopulated_fields = {"slug": ("title",)} 1a

16 raw_id_fields = ["author"] 1a

17 date_hierarchy = "publish" 1a

18 ordering = ["status", "publish"] 1a

19 inlines = [ 1a

20 CommentInline, 

21 ] 

22 

23 

24@admin.register(Comment) 1a

25class CommentAdmin(admin.ModelAdmin): 1a

26 list_display = ["name", "email", "post", "created", "active"] 1a

27 list_filter = ["active", "created", "updated"] 1a

28 search_fields = ["name", "email", "body"] 1a