text: from django.contrib import admin
  from blog.models import Category, Post
  
  @admin.register(Category)
  class CategoryAdmin(admin.ModelAdmin):
      readonly_fields = ('created', 'updated')
  
  
  @admin.register(Post)
  class PostAdmin(admin.ModelAdmin):
      readonly_fields = ('created', 'updated')
      list_display = ('title', 'author', 'published', 'post_categories')
      ordering = ('author', 'published')
      search_fields = ('title', 'content', 'author__username', 'categories__name')
      date_hierarchy = 'published'
      list_filter = ('author__username', 'categories__name')
  
      def post_categories(self, obj):
          return ", ".join([category.name for category in obj.categories.all().order_by("name")])
  
      post_categories.short_description = 'categorías'