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

from django_admin_listfilter_dropdown.filters import DropdownFilter
from mapwidgets.widgets import GooglePointFieldWidget

from . import models

# Register your models here.

class CompanyAdmin(admin.ModelAdmin):
    list_display = ('short_name', 'city', 'email', 'shop', 'platform', 'sync', 'is_validated', 'is_active', 'link')
    list_filter = ('platform', 'sync', 'is_validated', 'is_active', ('city', DropdownFilter))
    search_fields = ('short_name', 'company_name', 'email', 'web_link', 'city')

    formfield_overrides = {
        PointField: {"widget": GooglePointFieldWidget}
    }


admin.site.register(models.Company, CompanyAdmin)
