example_project_custom_group/posts/admin.py
raw| 1 | from django.contrib import admin |
| 2 | from posts.models import Post |
| 3 | |
| 4 | from guardian.admin import GuardedModelAdmin |
| 5 | |
| 6 | |
| 7 | @admin.register(Post) |
| 8 | class PostAdmin(GuardedModelAdmin): |
| 9 | prepopulated_fields = {"slug": ("title",)} |
| 10 | list_display = ("title", "slug", "created_at") |
| 11 | search_fields = ("title", "content") |
| 12 | ordering = ("-created_at",) |
| 13 | date_hierarchy = "created_at" |