from django.conf.urls import *
from django.urls import re_path as url

from django.urls import reverse_lazy
from django.contrib.auth.decorators import login_required
from django.views.generic.base import *


import nsclc.views

urlpatterns = [
                       
    url(r'^add/$', login_required(nsclc.views.add)),

    url(r'patient/$',        login_required(nsclc.views.PatientList.as_view()), name='patient_list'),
#    url(r'patient/add/$',                nsclc.views.PatientCreate.as_view(), name='patient_add'),
    url(r'patient/(?P<pk>\d+)/$',        login_required(nsclc.views.PatientDetail.as_view()), name='patient_detail'),
    url(r'patient/(?P<pk>\d+)/update/$', login_required(nsclc.views.PatientUpdate.as_view()), name='patient_update'),
    url(r'patient/(?P<pk>\d+)/delete/$', login_required(nsclc.views.PatientDelete.as_view()), name='patient_delete'),


    url(r'target/(?P<pk>\d+)/$',        login_required(nsclc.views.TargetDetail.as_view()), name='target_detail'),
    url(r'target/(?P<pk>\d+)/add/$',    login_required(nsclc.views.TargetAdd), name='target_add'),
    url(r'target/(?P<pk>\d+)/update/$', login_required(nsclc.views.TargetUpdate.as_view()), name='target_update'),
    url(r'target/(?P<pk>\d+)/delete/$', login_required(nsclc.views.TargetDelete.as_view()), name='target_delete'),


#      url(r'.*', redirect_to, {'url': reverse_lazy('patient_list')}),
    url(r'.*', RedirectView.as_view(url=reverse_lazy('patient_list'))),
                       
]

