| 80 | fields = ["id", "name", "slug", "created_at"] |
| 81 | |
| 82 | class ProductResource(Model): |
| 83 | label = "Product" |
| 84 | model = Product |
| 85 | filters = [ |
| 86 | filters.Enum(enum=enums.ProductType, name="type", label="ProductType"), |
| 87 | filters.Datetime(name="created_at", label="CreatedAt"), |
| 88 | ] |
| 89 | fields = [ |
| 90 | "id", |
| 91 | "name", |
| 92 | "view_num", |
| 93 | "sort", |
| 94 | "is_reviewed", |
| 95 | "type", |
| 96 | Field(name="image", label="Image", display=displays.Image(width="40")), |
| 97 | Field(name="body", label="Body", input_=inputs.Editor()), |
| 98 | "created_at", |
| 99 | ] |
| 100 | |
| 101 | label = "Content" |
| 102 | icon = "fas fa-bars" |