"""rowsandall_app URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url,include
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from rowsandall_app.views import rootview
from django.contrib.auth import views as auth_views
from rowers import views as rowersviews

from django.conf.urls import (
    handler400, handler403, handler404, handler500
)

handler400 = 'rowers.views.error400_view'
handler403 = 'rowers.views.error403_view'
handler404 = 'rowers.views.error404_view'
handler500 = 'rowers.views.error500_view'


urlpatterns = [
    url(r'^django-rq/',include('django_rq.urls')),
    url(r'^password_change_done/$',auth_views.password_change_done,name='password_change_done'),
    url(r'^password_change/$',auth_views.password_change),
    url(r'^password_reset/$',
        auth_views.password_reset,
        name='password_reset'),
    url(r'^password_reset/done/$',
        auth_views.password_reset_done,
        name='password_reset_done'),
    url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
        auth_views.password_reset_confirm,
        name='password_reset_confirm'),
    url(r'^reset/done/$', auth_views.password_reset_complete,
        name='password_reset_complete'),
    ]

urlpatterns += [
    url(r'^admin/', admin.site.urls),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    url(r'^$',rootview),
    url(r'^login/',auth_views.login, name='login'),
    url(r'^logout/',auth_views.logout_then_login,name='logout'),
#    url(r'^password_reset/$',auth_views.password_reset,name='password_reset'),
#    url(r'^password_reset_done/$',auth_views.password_reset_done,name='password_reset_done'),
#    url(r'^password_reset_confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', auth_views.password_reset_confirm,name='password_reset_confirm'),
#    url(r'^password_reset_confirm/$',auth_views.password_reset_confirm,name='password_reset_confirm'),
#    url(r'^password_reset_complete/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', auth_views.password_reset_complete,name='password_reset_complete'),
#    url(r'^password_reset_complete/$',auth_views.password_reset_complete,name='password_reset_complete'),
    url(r'^rowers/',include('rowers.urls')),
    url(r'^cvkbrno/',include('cvkbrno.urls')),
    url(r'^admin/rq/',include('django_rq_dashboard.urls')),
    url(r'^call\_back',rowersviews.rower_process_callback),
    url(r'^stravacall\_back',rowersviews.rower_process_stravacallback),
    url(r'^sporttracks\_callback',rowersviews.rower_process_sporttrackscallback),
    url(r'^underarmour\_callback',rowersviews.rower_process_underarmourcallback),
    url(r'^runkeeper\_callback',rowersviews.rower_process_runkeepercallback),
    url(r'^tp\_callback',rowersviews.rower_process_tpcallback),
    url(r'^twitter\_callback',rowersviews.rower_process_twittercallback),
    url(r'^i18n/', include('django.conf.urls.i18n')),
    url(r'^tz_detect/', include('tz_detect.urls')),
    ]


if settings.DEBUG:
    import debug_toolbar
    urlpatterns += [
        url(r'^__debug__/',include(debug_toolbar.urls)),
        ]
