from django import forms
from django.contrib import admin
from django.contrib.gis.db.models.fields import PointField

from . import models


class ReceiptInline(admin.TabularInline):
    extra = 0
    model = models.Receipt
    readonly_fields = ('name', 'tabc_permit', 'date', 'tax', 'address', 'city',
        'state', 'zip', 'county_code', 'business', 'location')


@admin.register(models.Business)
class BusinessAdmin(admin.ModelAdmin):
    list_display = ('name', )
    search_fields = ('name', )
    ordering = ('name', )
    inlines = [ReceiptInline, ]


@admin.register(models.Location)
class LocationAdmin(admin.ModelAdmin):
    formfield_overrides = {
        PointField: {
            'widget': forms.TextInput(attrs={'size': 80}),
        }
    }
    inlines = [ReceiptInline, ]
    list_filter = ('coordinate_quality', )
    save_on_top = True


@admin.register(models.Receipt)
class ReceiptAdmin(admin.ModelAdmin):
    list_display = ('name', 'date', 'tax', 'city', 'zip')
    search_fields = ('name', )
    readonly_fields = ('name', 'tabc_permit', 'date', 'tax', 'address', 'city',
        'state', 'zip', 'county_code', 'business', 'location')

@@ -623,24 +623,158 @@
 odelAdmin):%0A
+    def display_name(self, obj):%0A        return obj.data%5B'name'%5D%0A%0A    def display_tax(self, obj):%0A        return obj.data%5B'avg_tax'%5D%0A%0A
     formfiel
@@ -918,16 +918,89 @@
 line, %5D%0A
+    list_display = ('display_name', 'display_tax', 'coordinate_quality')%0A
     list

add more meaningful display to location admin