# Path: wagtailplus/wagtailaddresses/utils.py
# def get_component_urls():
#     """
#     Returns list of address component URLs based on address attribute map.
# 
#     :rtype: list.
#     """
#     component_patterns = []
#     
#     for component, label in ADDRESS_ATTR_MAP.iteritems():
#         label           = unicode(label)
#         chooser_name    = 'wagtailaddresses_{0}_chooser'.format(component)
#         create_name     = 'wagtailaddresses_{0}_create'.format(component)
#         
#         component_patterns.append(url(
#             r'^{0}-chooser/$'.format(label.lower().replace(' ', '-')),
#             choosers.ChooseComponentView.as_view(
#                 comp_type=label,
#                 chooser_name=chooser_name,
#                 create_name=create_name
#             ),
#             name=chooser_name
#         ))
#         
#         component_patterns.append(url(
#             r'^{0}-chooser/create/$'.format(label.lower().replace(' ', '-')),
#             choosers.CreateComponentView.as_view(
#                 comp_type=label,
#                 chooser_name=chooser_name,
#                 create_name=create_name
#             ),
#             name=create_name
#         ))
# 
#     return component_patterns
# 
# Path: wagtailplus/wagtailaddresses/views/addresses.py
# class IndexView(crud.IndexView):
# class CreateView(crud.CreateView):
# class UpdateView(crud.UpdateView):
# class DeleteView(crud.DeleteView):
# 
# Path: wagtailplus/wagtailaddresses/views/choosers.py
# class ChooseAddressView(chooser.ChooseView):
# class CreateAddressView(chooser.CreateView):
# class ChosenAddressView(chooser.ChosenView):
# class BaseComponentView(object):
# class ChooseComponentView(BaseComponentView, chooser.ChooseView):
# class CreateComponentView(BaseComponentView, chooser.CreateView):
# class ChosenComponentView(chooser.ChosenView):
# class UpdateComponentView(BaseComponentView, chooser.UpdateView):
#     def get_context_data(self, **kwargs):
#     def get_queryset(self):
#     def get_search_filters(self):
#     def get_form_kwargs(self):
#     def get_queryset(self):


from django.conf.urls import url
from django.contrib.auth.decorators import permission_required
from .utils import get_component_urls
from .views import addresses
from .views import choosers

    url(
        r'^delete/(?P<pk>\d+)/$',
        permission_required('wagtailaddresses.delete_address')(addresses.DeleteView.as_view()),
        name='wagtailaddresses_delete_address'
    ),
    # Address chooser URLs.
    url(
        r'^chooser/$',
        choosers.ChooseAddressView.as_view(),
        name='wagtailaddresses_address_chooser'
    ),
    url(
        r'^chooser/create/$',
        choosers.CreateAddressView.as_view(),
        name='wagtailaddresses_address_chooser_create'
    ),
    url(
        r'^chooser/(?P<pk>\d+)/$',
        choosers.ChosenAddressView.as_view(),
        name='wagtailaddresses_address_chosen'
    ),
    # Because address components are all derived from the same model, we only
    # need a single URL for choosing and editing them.
    url(
        r'^component-chooser/(?P<pk>\d+)/$',
        choosers.ChosenComponentView.as_view(),
        name='wagtailaddresses_component_chosen'
    ),
    url(
        r'^edit-component/(?P<pk>\d+)/$',

# Path: wagtailplus/wagtailaddresses/utils.py
# def get_component_urls():
#     """
#     Returns list of address component URLs based on address attribute map.
# 
#     :rtype: list.
#     """
#     component_patterns = []
#     
#     for component, label in ADDRESS_ATTR_MAP.iteritems():
#         label           = unicode(label)
#         chooser_name    = 'wagtailaddresses_{0}_chooser'.format(component)
#         create_name     = 'wagtailaddresses_{0}_create'.format(component)
#         
#         component_patterns.append(url(
#             r'^{0}-chooser/$'.format(label.lower().replace(' ', '-')),
#             choosers.ChooseComponentView.as_view(
#                 comp_type=label,
#                 chooser_name=chooser_name,
#                 create_name=create_name
#             ),
#             name=chooser_name
#         ))
#         
#         component_patterns.append(url(
#             r'^{0}-chooser/create/$'.format(label.lower().replace(' ', '-')),
#             choosers.CreateComponentView.as_view(
#                 comp_type=label,
#                 chooser_name=chooser_name,
#                 create_name=create_name
#             ),
#             name=create_name
#         ))
# 
#     return component_patterns
# 
# Path: wagtailplus/wagtailaddresses/views/addresses.py
# class IndexView(crud.IndexView):
# class CreateView(crud.CreateView):
# class UpdateView(crud.UpdateView):
# class DeleteView(crud.DeleteView):
# 
# Path: wagtailplus/wagtailaddresses/views/choosers.py
# class ChooseAddressView(chooser.ChooseView):
# class CreateAddressView(chooser.CreateView):
# class ChosenAddressView(chooser.ChosenView):
# class BaseComponentView(object):
# class ChooseComponentView(BaseComponentView, chooser.ChooseView):
# class CreateComponentView(BaseComponentView, chooser.CreateView):
# class ChosenComponentView(chooser.ChosenView):
# class UpdateComponentView(BaseComponentView, chooser.UpdateView):
#     def get_context_data(self, **kwargs):
#     def get_queryset(self):
#     def get_search_filters(self):
#     def get_form_kwargs(self):
#     def get_queryset(self):


# Path: wagtailplus/wagtailaddresses/admin_urls.py
from django.conf.urls import url
from django.contrib.auth.decorators import permission_required
from .utils import get_component_urls
from .views import addresses
from .views import choosers

    url(
        r'^delete/(?P<pk>\d+)/$',
        permission_required('wagtailaddresses.delete_address')(addresses.DeleteView.as_view()),
        name='wagtailaddresses_delete_address'
    ),
    # Address chooser URLs.
    url(
        r'^chooser/$',
        choosers.ChooseAddressView.as_view(),
        name='wagtailaddresses_address_chooser'
    ),
    url(
        r'^chooser/create/$',
        choosers.CreateAddressView.as_view(),
        name='wagtailaddresses_address_chooser_create'
    ),
    url(
        r'^chooser/(?P<pk>\d+)/$',
        choosers.ChosenAddressView.as_view(),
        name='wagtailaddresses_address_chosen'
    ),
    # Because address components are all derived from the same model, we only
    # need a single URL for choosing and editing them.
    url(
        r'^component-chooser/(?P<pk>\d+)/$',
        choosers.ChosenComponentView.as_view(),
        name='wagtailaddresses_component_chosen'
    ),
    url(
        r'^edit-component/(?P<pk>\d+)/$',

        choosers.UpdateComponentView.as_view(),
