admin.py 407 B

1234567891011121314151617181920212223242526
  1. from django.contrib import admin
  2. from models import Post, Comment
  3. # Register your models here.
  4. # admin model for Posts:
  5. class PostAdmin(admin.ModelAdmin):
  6. fields = [
  7. 'title',
  8. 'content',
  9. ]
  10. list_display = (
  11. 'title',
  12. 'pub_date',
  13. 'last_edited',
  14. )
  15. list_filter = ['last_edited']
  16. admin.site.register(Post, PostAdmin)
  17. admin.site.register(Comment)