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',)