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