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, TemplateView
from django.conf.urls import url, include

urlpatterns = [
    path('', RedirectView.as_view(url='projekte/'), name='index'),
    path('about/', views.about, name='about'),
    path('submit/', views.submit, name='submit'),
    path('projekte/', views.ProductsView.as_view(), name='products'),
    path('projekte/filter/<slug:filter>/', views.FilterProductsView.as_view(), name='products-filter-view'),
    path('projekte/search', views.SearchProductsView.as_view(), name='search-products'),
    path('products-list/', views.ProductsListView.as_view(), name='products-list'),
    path('products-list/embed', views.ProductsListView.as_view(  embed=True,  ), name='products-list-embed'),
    path('agent_newsletter/', views.AgentNewslwtterFormView.as_view(), name='search-agent-form'),
    path('agent_newsletter/embed/', views.AgentNewslwtterFormView.as_view( embed=True, ), name='search-agent-form-embed'),
    path('agent_newsletter/<slug:newsletter_slug>/anmelden/', views.AgentNewslwtterSubscribeView.as_view(   ), name='agent-newsletter-create'),
    # path('suchagent/embed', views.SearchAgentCreate.as_view( embed=True, ), name='search-agent-create-embed'),
    path('suchagent/<int:pk>/<slug:hash>/', views.SearchAgentDelete.as_view(), name='search-agent-delete'),
    path('projekt/<int:pk>/', views.DetailView.as_view(), name='product-detail'),
    path('projekt/<int:pk>/delete', views.ProductDelete.as_view(), name='product-delete'),
    path('projekt/<int:pk>/embed', views.DetailView.as_view( embed=True, ), name='product-detail-embed'),
    path('projekt/<int:pk>/freigeben', views.ProductPublish.as_view(  ), name='product-publish'),
    path('product-card/<int:pk>', views.CardDetailView.as_view(), name='product-detail-card'),
    path('product-card/<int:pk>/embed', views.CardDetailView.as_view( embed=True, ), name='product-detail-card-embed'),
    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('neues-wohnprojekt/', views.WohnProjektCreateView.as_view(), name='neues-wohnprojekt'),
    path('neues-mobilitaetsprojekt/', views.MobilitaetsProjektCreateView.as_view(), name='neues-mobilitaetsprojekt'),
    path('meine-projekte/', views.UsersProducts.as_view(), name='meine-projekte'),
    path('projekt-bearbeiten/<int:pk>', views.WohnProjektUpdateView.as_view(), name='projekt-bearbeiten'),
    path('add-image/<int:pk>', views.addImageView.as_view(), name='add-image'),
    # path('generic-test/', views.genericView.as_view(), name='generic-test'),
    path('pages/<slug:page>/', pagesView.as_view(template_name="marktplatz/generic.html"), name='pages-generic'),
    path('generic/', TemplateView.as_view(template_name="marktplatz/generic.html"), name='generic'),
    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)
