from django.contrib import admin from .models import Brand, Product, ItemIssues, Post, Image admin.site.register(Brand) @admin.register(ItemIssues) class ItemIssuesAdmin(admin.ModelAdmin): list_display = ( "display", "frame", "button", "biometric", "camera", "speaker", "others", ) @admin.register(Image) class ImageAdmin(admin.ModelAdmin): list_display = ("post", "image") raw_id_fields = ("post",) @admin.register(Product) class ProductAdmin(admin.ModelAdmin): list_display = ("name", "brand", "release_date") list_filter = ("brand", "release_date") search_fields = ("name",) date_hierarchy = "release_date" @admin.register(Post) class PostAdmin(admin.ModelAdmin): list_display = ( "product", "price", "item_issues", "done", "written_at", ) list_filter = ("done", "written_at") search_fields = ("product", "text") date_hierarchy = "written_at" raw_id_fields = ( "author", "product", "item_issues", )