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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
from django.contrib import admin
from django import forms
from django.contrib.gis.admin import OSMGeoAdmin
from django.contrib.contenttypes.admin import GenericStackedInline
from django_admin_listfilter_dropdown.filters import DropdownFilter, RelatedDropdownFilter, ChoiceDropdownFilter
from .models import Deal, Brand, MyDeal, REIDeal
@admin.register(Deal)
class DealAdmin(OSMGeoAdmin):
list_display = ('asin', 'title', 'brand', 'category', 'deal_price', 'original_price', 'discount_percent', 'promo_type', 'amazon_link', 'search_ccc', 'search_wired', 'get_airtable_code')
search_fields = ['brand__name', 'title', ]
list_filter = ('category', 'promo_type', ('brand_str', DropdownFilter),)
@admin.register(Brand)
class BrandAdmin(OSMGeoAdmin):
list_display = ('name',)
search_fields = ['name' ]
@admin.register(MyDeal)
class MyDealAdmin(OSMGeoAdmin):
list_display = ('title', 'blurb', 'amazon_link', 'search_ccc', 'search_wired')
search_fields = ['title', ]
list_filter = ()
fieldsets = (
('Base', {
'fields': (
'title',
'blurb',
('retailer', 'asin'),
'url',
'body',
),
'classes': (
'show',
'extrapretty',
'wide'
)
}
),
)
@admin.register(REIDeal)
class DealAdmin(OSMGeoAdmin):
list_display = ('title', 'rei_link', 'brand_str', 'category', 'deal_price', 'original_price', 'generate_deal' )
search_fields = ['brand_str', 'title', ]
list_filter = ('category', 'brand_str',)
list_editable = ('generate_deal',)
|