summaryrefslogtreecommitdiff
path: root/app/products/admin.py
blob: 3a26358742197c1c9993225b60c5209e39784fb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from django.contrib import admin

from .models import Brand, Product
from utils.widgets import AdminImageWidget, LGEntryForm


@admin.register(Product)
class ProductAdmin(admin.ModelAdmin):
    form = LGEntryForm
    list_display = ('name', 'admin_thumbnail', 'rating', 'pub_date')
    search_fields = ['name', 'body_markdown']
    list_filter = ('rating', 'pub_date')

    class Media:
        js = ('image-loader.js', 'next-prev-links.js')
        css = {
            "all": ("my_styles.css",)
        }


@admin.register(Brand)
class BrandAdmin(admin.ModelAdmin):
    list_display = ('name', )
    search_fields = ['name',]
    list_filter = ('pub_date',)

    class Media:
        js = ('next-prev-links.js',)