# Path: wagtailplus/wagtailaddresses/app_settings.py
# ADDRESS_ATTR_MAP        = getattr(settings, 'ADDRESS_ATTR_MAP', DEFAULT_ADDRESS_ATTR_MAP)
# 
# Path: wagtailplus/wagtailaddresses/app_settings.py
# ADDRESS_FORMAT          = getattr(settings, 'ADDRESS_FORMAT', DEFAULT_ADDRESS_FORMAT)
# 
# Path: wagtailplus/wagtailaddresses/app_settings.py
# ADDRESS_FORMAT_FIELDS   = getattr(settings, 'ADDRESS_FORMAT_FIELDS', DEFAULT_ADDRESS_FORMAT_FIELDS)
# 
# Path: wagtailplus/wagtailaddresses/edit_handlers.py
# def AddressComponentChooserPanel(field_name):
#     """
#     Returns choser panel class with specified field name.
# 
#     :param field_name: field name of chosen model.
#     """
#     return type('_AddressComponentChooserPanel', (BaseAddressComponentChooserPanel,), {
#         'field_name': field_name,
#     })


import json
import urllib2
from django.conf import settings
from django.contrib.gis.geos import Point
from django.utils.encoding import python_2_unicode_compatible
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from taggit.managers import TaggableManager
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailadmin.edit_handlers import MultiFieldPanel
from wagtail.wagtailadmin.edit_handlers import ObjectList
from wagtail.wagtailadmin.taggable import TagSearchable
from wagtail.wagtailsearch import index
from .app_settings import ADDRESS_ATTR_MAP
from .app_settings import ADDRESS_FORMAT
from .app_settings import ADDRESS_FORMAT_FIELDS
from .edit_handlers import AddressComponentChooserPanel
    from django.contrib.gis.db import models
    from django.db import models

        Automatically sets address geometry and saves instance.
        """
        # Set address label.
        self.label = self.__str__()

        # Attempt to set geometry if empty.
        if not self.geom:
            data = get_address_data(self.__str__())
            if data:
                self.geom = get_geom_from_data(data)

        super(Address, self).save(*args, **kwargs)

    @classmethod
    def get_edit_handler(cls):
        """
        Returns edit handler instance.

        :rtype: wagtail.wagtailadmin.edit_handlers.ObjectList.
        """
        return ObjectList(cls.content_panels)

Address.content_panels = [
    FieldPanel('street_number', classname='full title'),
    MultiFieldPanel([
        AddressComponentChooserPanel('route'),
        AddressComponentChooserPanel('locality'),
        AddressComponentChooserPanel('administrative_area_level_2'),
        AddressComponentChooserPanel('administrative_area_level_1'),
        AddressComponentChooserPanel('postal_code'),

# Path: wagtailplus/wagtailaddresses/app_settings.py
# ADDRESS_ATTR_MAP        = getattr(settings, 'ADDRESS_ATTR_MAP', DEFAULT_ADDRESS_ATTR_MAP)
# 
# Path: wagtailplus/wagtailaddresses/app_settings.py
# ADDRESS_FORMAT          = getattr(settings, 'ADDRESS_FORMAT', DEFAULT_ADDRESS_FORMAT)
# 
# Path: wagtailplus/wagtailaddresses/app_settings.py
# ADDRESS_FORMAT_FIELDS   = getattr(settings, 'ADDRESS_FORMAT_FIELDS', DEFAULT_ADDRESS_FORMAT_FIELDS)
# 
# Path: wagtailplus/wagtailaddresses/edit_handlers.py
# def AddressComponentChooserPanel(field_name):
#     """
#     Returns choser panel class with specified field name.
# 
#     :param field_name: field name of chosen model.
#     """
#     return type('_AddressComponentChooserPanel', (BaseAddressComponentChooserPanel,), {
#         'field_name': field_name,
#     })


# Path: wagtailplus/wagtailaddresses/models.py
import json
import urllib2
from django.conf import settings
from django.contrib.gis.geos import Point
from django.utils.encoding import python_2_unicode_compatible
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from taggit.managers import TaggableManager
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailadmin.edit_handlers import MultiFieldPanel
from wagtail.wagtailadmin.edit_handlers import ObjectList
from wagtail.wagtailadmin.taggable import TagSearchable
from wagtail.wagtailsearch import index
from .app_settings import ADDRESS_ATTR_MAP
from .app_settings import ADDRESS_FORMAT
from .app_settings import ADDRESS_FORMAT_FIELDS
from .edit_handlers import AddressComponentChooserPanel
    from django.contrib.gis.db import models
    from django.db import models

        Automatically sets address geometry and saves instance.
        """
        # Set address label.
        self.label = self.__str__()

        # Attempt to set geometry if empty.
        if not self.geom:
            data = get_address_data(self.__str__())
            if data:
                self.geom = get_geom_from_data(data)

        super(Address, self).save(*args, **kwargs)

    @classmethod
    def get_edit_handler(cls):
        """
        Returns edit handler instance.

        :rtype: wagtail.wagtailadmin.edit_handlers.ObjectList.
        """
        return ObjectList(cls.content_panels)

Address.content_panels = [
    FieldPanel('street_number', classname='full title'),
    MultiFieldPanel([
        AddressComponentChooserPanel('route'),
        AddressComponentChooserPanel('locality'),
        AddressComponentChooserPanel('administrative_area_level_2'),
        AddressComponentChooserPanel('administrative_area_level_1'),
        AddressComponentChooserPanel('postal_code'),

        AddressComponentChooserPanel('country'),
