# Path: dplace_app/views.py
# def view_language(request, glottocode):
# def download_file(request):
# def angular(request):
# 
# Path: dplace_app/api_views.py
# class VariableViewSet(viewsets.ReadOnlyModelViewSet):
# class CategoryViewSet(viewsets.ReadOnlyModelViewSet):
# class CodeDescriptionViewSet(viewsets.ReadOnlyModelViewSet):
# class ValueViewSet(viewsets.ReadOnlyModelViewSet):
# class SocietyViewSet(viewsets.ReadOnlyModelViewSet):
# class LargeResultsSetPagination(PageNumberPagination):
# class VeryLargeResultsSetPagination(PageNumberPagination):
# class LanguageViewSet(viewsets.ReadOnlyModelViewSet):
# class LanguageFamilyViewSet(viewsets.ReadOnlyModelViewSet):
# class TreeResultsSetPagination(PageNumberPagination):
# class LanguageTreeViewSet(viewsets.ReadOnlyModelViewSet):
# class LanguageTreeLabelsViewSet(viewsets.ReadOnlyModelViewSet):
# class SourceViewSet(viewsets.ReadOnlyModelViewSet):
# class GeographicRegionViewSet(viewsets.ReadOnlyModelViewSet):
#     def retrieve(self, request, *args, **kwargs):
#     def retrieve(self, request, *args, **kwargs):
#     def detail(self, request, society_id):
# def get_query_from_json(request):
# def result_set_from_query_dict(query_dict):
#     def id_array(l):
# def trees_from_societies(request):
# def find_societies(request):
# def get_categories(request):
# def get_dataset_sources(request):
# def get_min_and_max(request):
# def bin_cont_data(request):  # MAKE THIS GENERIC
# def csv_download(request):


from django.conf.urls import url, include
from django.views.generic.base import RedirectView
from rest_framework import routers
from rest_framework import renderers
from dplace_app import views, api_views


router = routers.DefaultRouter()
router.register(r'variables', api_views.VariableViewSet)
router.register(r'categories', api_views.CategoryViewSet)
router.register(r'codes', api_views.CodeDescriptionViewSet)
router.register(r'values', api_views.ValueViewSet)
router.register(r'societies', api_views.SocietyViewSet)
router.register(r'language_families', api_views.LanguageFamilyViewSet)
router.register(r'languages', api_views.LanguageViewSet)
router.register(r'language_trees', api_views.LanguageTreeViewSet)
router.register(r'geographic_regions', api_views.GeographicRegionViewSet)
router.register(r'sources', api_views.SourceViewSet)
router.register(r'language_tree_labels', api_views.LanguageTreeLabelsViewSet)

urlpatterns = [

    #   !!!!!!  Important  !!!!!!
    #   To reduce traffic caused by bots, spiders, etc
    #   all URL paths with "...?param1=a&param2=b" etc. will return HTTP 404
    #   It's set in:
    #   - "views.py" => def angular(request): [for all pages passed to angular]
    #   - "api_views.py" => def detail(self, request, society_id): [for /society/...?...&]

    url(r'^$', RedirectView.as_view(url='angular/', permanent=True), name='home'),

    # Redirect all static icon images (different sizes) crawled by any sites and bots
    url(r'^favicon\.ico/?$', RedirectView.as_view(url='/static/images/icons/favicon.ico')),
    url(r'^apple\-touch\-icon(\-precomposed)?\.png/?$', RedirectView.as_view(url='/static/images/icons/D-PLACE_Favicon_57x57.png')),
    url(r'^touch\-icon\iphone-\.png/?$', RedirectView.as_view(url='/static/images/icons/D-PLACE_Favicon_57x57.png')),

# Path: dplace_app/views.py
# def view_language(request, glottocode):
# def download_file(request):
# def angular(request):
# 
# Path: dplace_app/api_views.py
# class VariableViewSet(viewsets.ReadOnlyModelViewSet):
# class CategoryViewSet(viewsets.ReadOnlyModelViewSet):
# class CodeDescriptionViewSet(viewsets.ReadOnlyModelViewSet):
# class ValueViewSet(viewsets.ReadOnlyModelViewSet):
# class SocietyViewSet(viewsets.ReadOnlyModelViewSet):
# class LargeResultsSetPagination(PageNumberPagination):
# class VeryLargeResultsSetPagination(PageNumberPagination):
# class LanguageViewSet(viewsets.ReadOnlyModelViewSet):
# class LanguageFamilyViewSet(viewsets.ReadOnlyModelViewSet):
# class TreeResultsSetPagination(PageNumberPagination):
# class LanguageTreeViewSet(viewsets.ReadOnlyModelViewSet):
# class LanguageTreeLabelsViewSet(viewsets.ReadOnlyModelViewSet):
# class SourceViewSet(viewsets.ReadOnlyModelViewSet):
# class GeographicRegionViewSet(viewsets.ReadOnlyModelViewSet):
#     def retrieve(self, request, *args, **kwargs):
#     def retrieve(self, request, *args, **kwargs):
#     def detail(self, request, society_id):
# def get_query_from_json(request):
# def result_set_from_query_dict(query_dict):
#     def id_array(l):
# def trees_from_societies(request):
# def find_societies(request):
# def get_categories(request):
# def get_dataset_sources(request):
# def get_min_and_max(request):
# def bin_cont_data(request):  # MAKE THIS GENERIC
# def csv_download(request):


# Path: dplace_app/urls.py
from django.conf.urls import url, include
from django.views.generic.base import RedirectView
from rest_framework import routers
from rest_framework import renderers
from dplace_app import views, api_views



router = routers.DefaultRouter()
router.register(r'variables', api_views.VariableViewSet)
router.register(r'categories', api_views.CategoryViewSet)
router.register(r'codes', api_views.CodeDescriptionViewSet)
router.register(r'values', api_views.ValueViewSet)
router.register(r'societies', api_views.SocietyViewSet)
router.register(r'language_families', api_views.LanguageFamilyViewSet)
router.register(r'languages', api_views.LanguageViewSet)
router.register(r'language_trees', api_views.LanguageTreeViewSet)
router.register(r'geographic_regions', api_views.GeographicRegionViewSet)
router.register(r'sources', api_views.SourceViewSet)
router.register(r'language_tree_labels', api_views.LanguageTreeLabelsViewSet)

urlpatterns = [

    #   !!!!!!  Important  !!!!!!
    #   To reduce traffic caused by bots, spiders, etc
    #   all URL paths with "...?param1=a&param2=b" etc. will return HTTP 404
    #   It's set in:
    #   - "views.py" => def angular(request): [for all pages passed to angular]
    #   - "api_views.py" => def detail(self, request, society_id): [for /society/...?...&]

    url(r'^$', RedirectView.as_view(url='angular/', permanent=True), name='home'),

    # Redirect all static icon images (different sizes) crawled by any sites and bots
    url(r'^favicon\.ico/?$', RedirectView.as_view(url='/static/images/icons/favicon.ico')),
    url(r'^apple\-touch\-icon(\-precomposed)?\.png/?$', RedirectView.as_view(url='/static/images/icons/D-PLACE_Favicon_57x57.png')),
    url(r'^touch\-icon\iphone-\.png/?$', RedirectView.as_view(url='/static/images/icons/D-PLACE_Favicon_57x57.png')),

    url(r'^(apple\-)?touch\-icon\-(?P<size>.+?)(\-precomposed)?\.png/?$', RedirectView.as_view(url='/static/images/icons/D-PLACE_Favicon_%(size)s.png')),