"""myproject URL Configuration

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

from . import views
from webmap import views as vi2
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('password_reset/', auth_views.PasswordResetView.as_view(), name='password_reset'),
    path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
    re_path(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,40})/$',
        auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
    path('reset/done$', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
    path('admin/', admin.site.urls),
    path('webmap/', include('webmap.urls')),
    path('addpoint/', include('webmap.urls')),
    path('deletepoint/', include('webmap.urls')),
    path('changepoint/', include('webmap.urls')),
    path('converttopdf/', include('webmap.urls')),
    path('login/', auth_views.LoginView.as_view(template_name='webmap/login.html'), name='login'),
    ###path('login/', vi2.login2, name='login2'),
    ###path('activate/<uidb64>/<token>', vi2.activate, name='activate'),
    path('logout/', auth_views.LogoutView.as_view(template_name='webmap/logout.html'), name='logout'),
    # Change Password
    path(
        'change-password/',
        auth_views.PasswordChangeView.as_view(
            template_name='registration/change_password.html',
            success_url = '/'
        ),
        name='change_password'
    ),
#    url(r'^$', views.index),
    path('/', include('webmap.urls'), name='index'),
    path('', include('webmap.urls')),
]

if settings.DEBUG is True:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
