2023-05-01 20:49:25 +09:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2023-11-09 19:41:37 +09:00
|
|
|
from .models import Brand, Product, ItemIssues, Post, Image
|
2023-05-01 20:49:25 +09:00
|
|
|
|
|
|
|
|
|
|
|
admin.site.register(Brand)
|
2023-11-13 19:52:35 +09:00
|
|
|
|
|
|
|
|
|
|
|
@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"
|
2023-05-01 20:49:25 +09:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Post)
|
|
|
|
class PostAdmin(admin.ModelAdmin):
|
|
|
|
list_display = (
|
|
|
|
"product",
|
|
|
|
"price",
|
2023-11-09 19:41:37 +09:00
|
|
|
"item_issues",
|
|
|
|
"done",
|
2023-05-01 20:49:25 +09:00
|
|
|
"written_at",
|
|
|
|
)
|
2023-11-09 19:41:37 +09:00
|
|
|
list_filter = ("done", "written_at")
|
2023-05-01 20:49:25 +09:00
|
|
|
search_fields = ("product", "text")
|
|
|
|
date_hierarchy = "written_at"
|
2023-11-13 19:52:35 +09:00
|
|
|
raw_id_fields = (
|
|
|
|
"author",
|
|
|
|
"product",
|
|
|
|
"item_issues",
|
|
|
|
)
|