from django.urls import path
from . import views
from .views import *
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic import RedirectView
from django.conf.urls import url, include

urlpatterns = [
    path('', RedirectView.as_view(url='products/'), name='index'),
    path('about/', views.about, name='about'),
    path('submit/', views.submit, name='submit'),
    path('products/', views.ProductsView.as_view(), name='products'),
    path('suchagent/', views.SearchAgentCreate.as_view(), name='search-agent-create'),
    path('product/<int:pk>', views.DetailView.as_view(), name='product-detail'),
    path('product/<int:pk>/embed', views.DetailView.as_view( embed=True, ), name='product-detail-embed'),
    path('votes/', views.VoteView.as_view(), name='vote-detail'),
    path('votescid/', views.CidView.as_view(), name='votecid-detail'),
    path('admin_panel/', views.AdminView.as_view(), name='admin-panel'),
    path('light-box/', lightboximg.as_view(template_name="mab18/importold.html"),name='lightbox'),
    path('register/', views.registerView.as_view(), name='register-view'),
    path('addProduct/', views.NewSubmitView.as_view(), name='new-submit-view'),
    path('myProducts/', views.UsersProducts.as_view(), name='my-products'),
    path('editProduct/<int:pk>', views.EditView.as_view(), name='edit-product'),
    path('addImage/<int:pk>', views.uploadView.as_view(), name='add-Image'),
    path('images/<int:pk>', views.MediaView.as_view(), name='media-overview'),
    url(r'^delete_media/(?P<pk>\d+)/$', views.delete_media, name='delete-media'),
    url(r'^delete_video/(?P<pk>\d+)/$', views.delete_video, name='delete-video'),
    url(r'^upload/', include('django_file_form.urls')),
    url(r'^handle_upload$', views.handle_upload, name='file_form_handle_upload'),
    url(r'^upload_mab$', views.handle_upload, name='upload_mab'),
    url(r'^home', views.home, name='home'),
    ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
