Created
April 27, 2021 19:32
-
-
Save ryanleonbutler/59b08a8cbe7c2aa6f1f6ad22345d547f to your computer and use it in GitHub Desktop.
Django admin example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| from django.contrib import admin | |
| from blog.models import Post, Category | |
| class CategoryAdmin(admin.ModelAdmin): | |
| pass | |
| class PostAdmin(admin.ModelAdmin): | |
| list_display = ("title", "status", "created_on", "last_modified") | |
| list_filter = ("status",) | |
| search_fields = ["title", "body"] | |
| admin.site.register(Post, PostAdmin) | |
| admin.site.register(Category, CategoryAdmin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment