# from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib.auth.views import *
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import include, path, re_path
from django.views.generic import TemplateView

import fileupload.views

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

from django.contrib import admin
admin.autodiscover()

#from fileupload.views import PictureCreateView, PictureDeleteView, multiple_uploader
#from registry.views import PictureCreateView, PictureDeleteView, multiple_uploader

from registry import views as registry_views

urlpatterns = [
    # Examples:
    # re_path(r'^$', 'ntuh.views.home', name='home'),
    # re_path(r'^ntuh/', include('ntuh.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # re_path(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # re_path(r'^admin/', include(admin.site.urls)),

    # re_path(r'^admin/', include(admin.site.urls)),
    re_path(r'^admin/', admin.site.urls),
#    re_path(r'', include('multiuploader.urls')),
    
    # re_path(r'^accounts/login/', login),
    # re_path(r'^accounts/logout/', logout),
    path('accounts/', include('django.contrib.auth.urls')), # new
    
    # re_path(r'^registry/op_category/', 'registry.views.op_category'),
    re_path(r'^registry/op_category/', registry_views.op_category),
    re_path(r'^registry/op_charge/', registry_views.op_charge),
    re_path(r'^registry/op_charge1/', registry_views.op_charge1),
    
    
    re_path(r'^registry/op_note/(?P<PatChartNo>\d+)/(?P<date>\d{4}-\d\d-\d\d)/', registry_views.op_note),
    re_path(r'^registry/patho_report/(?P<PatChartNo>\d+)/(?P<date>\d{4}-\d\d-\d\d)/', registry_views.patho_report),
    
    re_path(r'^registry/op_prepare/', registry_views.op_prepare),
    
    re_path(r'^registry/op_schedule/', registry_views.op_schedule),
    re_path(r'^registry/op_edit/', registry_views.op_edit),
    
    re_path(r'^registry/op_search/', registry_views.op_search),
    re_path(r'^registry/patho_search/', registry_views.patho_search),
    re_path(r'^registry/op_uncategorized/', registry_views.op_uncategorized),
    re_path(r'^registry/op_month/', registry_views.op_month),
    re_path(r'^registry/op_year/', registry_views.op_year),
    re_path(r'^registry/op_report/', registry_views.op_report),
    
    re_path(r'^Default_Dr/(?P<ChartNo>\d+)/', registry_views.Default_Dr),
    
    re_path(r'^changelog', TemplateView.as_view(template_name='changelog.html')),
    
#    re_path(r'^registry/op_images/(?P<PatChartNo>\d+)/(?P<date>\d{4}-\d\d-\d\d)/', 'registry.views.op_images'),
    
#    re_path(r'^registry/test/', 'registry.views.test'),

    re_path(r'^$', registry_views.op_schedule),

    re_path(r'^upload/', include('fileupload.urls')),
   
    re_path(r'^upload/new/(?P<content_type>[^/]+)/(?P<object_id>.+)/$', 
     fileupload.views.PictureCreateView.as_view(), {}, 'upload-new-object'),
                       
#    (r'^registry/fileupload/(?P<content_type>[^/]+)/(?P<object_id>.+)/$', 
#     fileupload.views.PictureCreateView.as_view(), {}, 'upload-new-object'),

    re_path(r'^search/', include('haystack.urls')),
   

# ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
]

urlpatterns += staticfiles_urlpatterns()

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