from django.conf.urls import patterns, include, url

import autocomplete_light
autocomplete_light.autodiscover()

from django.contrib import admin
admin.autodiscover()

from django.views.generic.list import ListView
from django.views.generic.base import TemplateView
from bda.models import Spectacle
from bda2.models import Spectacle as Spectacle2
from bda3.models import Spectacle as Spectacle3
from gestioncof.petits_cours_views import DemandeListView

urlpatterns = patterns('',
    url(r'^$', 'gestioncof.views.home', name = 'home'),
    url(r'^cof/denied$',  TemplateView.as_view(template_name = 'cof-denied.html'), name = "cof-denied"),
    url(r'^cas/login$', 'django_cas.views.login', name = "cas_login_view"),
    url(r'^cas/logout$', 'django_cas.views.logout'),
    url(r'^outsider/login$', 'gestioncof.views.login_ext'),
    url(r'^outsider/logout$', 'django.contrib.auth.views.logout', {'next_page': '/gestion/'}),
    url(r'^outsider/password-change$', 'django.contrib.auth.views.password_change'),
    url(r'^outsider/password-change-done$', 'django.contrib.auth.views.password_change_done'),
    url(r'^login$', 'gestioncof.views.login'),
    url(r'^logout$', 'gestioncof.views.logout'),
    url(r'^profile$', 'gestioncof.views.profile'),
    url(r'^export/members$', 'gestioncof.views.export_members'),
    url(r'^export/mega/avecremarques$', 'gestioncof.views.export_mega_remarksonly'),
    url(r'^export/mega/participants$', 'gestioncof.views.export_mega_participants'),
    url(r'^export/mega/orgas$', 'gestioncof.views.export_mega_orgas'),
    url(r'^export/mega/(?P<type>.+)$', 'gestioncof.views.export_mega_bytype'),
    url(r'^export/mega$', 'gestioncof.views.export_mega'),
    url(r'^registration$', 'gestioncof.views.registration'),
    url(r'^registration/clipper/(?P<login_clipper>[\w-]+)$', 'gestioncof.views.registration_form2', name = "clipper-registration"),
    url(r'^registration/user/(?P<username>.+)$', 'gestioncof.views.registration_form2', name = "user-registration"),
    url(r'^registration/empty$', 'gestioncof.views.registration_form2', name = "empty-registration"),
    url(r'^petitcours/inscription$', 'gestioncof.petits_cours_views.inscription', name = 'petits-cours-inscription'),
    url(r'^petitcours/demande$', 'gestioncof.petits_cours_views.demande', name = 'petits-cours-demande'),
    url(r'^petitcours/demande-raw$', 'gestioncof.petits_cours_views.demande_raw', name = 'petits-cours-demande-raw'),
    url(r'^petitcours/demandes$', DemandeListView.as_view(), name = 'petits-cours-demandes-list'),
    url(r'^petitcours/demandes/(?P<demande_id>\d+)$', 'gestioncof.petits_cours_views.details', name = 'petits-cours-demande-details'),
    url(r'^petitcours/demandes/(?P<demande_id>\d+)/traitement$', 'gestioncof.petits_cours_views.traitement', name = 'petits-cours-demande-traitement'),
    url(r'^petitcours/demandes/(?P<demande_id>\d+)/retraitement$', 'gestioncof.petits_cours_views.retraitement', name = 'petits-cours-demande-retraitement'),
    url(r'^bda/inscription$', 'bda.views.inscription', name = 'bda-tirage-inscription'),
	url(r'^bda2/inscription$', 'bda2.views.inscription', name = 'bda2-tirage-inscription'),
	url(r'^bda3/inscription$', 'bda3.views.inscription', name = 'bda3-tirage-inscription'),
    url(r'^bda/places$', 'bda.views.places', name = "bda-places-attribuees"),
    url(r'^bda/places/places_bda.ics$', 'bda.views.places_ics', name = "bda-places-attribuees-ics"),
    url(r'^bda2/places$', 'bda2.views.places', name = "bda2-places-attribuees"),
    url(r'^bda3/places$', 'bda3.views.places', name = "bda3-places-attribuees"),
    url(r'^bda/revente$', 'bda.views.revente', name = 'bda-revente'),
    url(r'^bda2/revente$', 'bda2.views.revente', name = 'bda2-revente'),
    url(r'^bda3/revente$', 'bda3.views.revente', name = 'bda3-revente'),
    url(r'^bda/etat-places$', 'bda.views.etat_places', name = 'bda-etat-places'),
    url(r'^bda2/etat-places$', 'bda2.views.etat_places', name = 'bda2-etat-places'),
    url(r'^bda3/etat-places$', 'bda3.views.etat_places', name = 'bda3-etat-places'),
    url(r'^bda/tirage$', 'bda.views.tirage'),
    url(r'^bda2/tirage$', 'bda2.views.tirage'),
    url(r'^bda3/tirage$', 'bda3.views.tirage'),
    url(r'^bda/spectacles/$', ListView.as_view(model = Spectacle), name ="bda-liste-spectacles"),
    url(r'^bda/spectacles/liste_spectacles.ics$', 'bda.views.liste_spectacles_ics', name ="bda-liste-spectacles-ics"),
    url(r'^bda/spectacles/unpaid$', "bda.views.unpaid", name = "bda-unpaid"),
    url(r'^bda/spectacles/(?P<spectacle_id>\d+)$', "bda.views.spectacle", name = "bda-spectacle"),
    url(r'^bda/spectacles-2/$', ListView.as_view(model = Spectacle2), name ="bda2-liste-spectacles"),
    url(r'^bda/spectacles-2/unpaid$', "bda2.views.unpaid", name = "bda2-unpaid"),
    url(r'^bda/spectacles-2/(?P<spectacle_id>\d+)$', "bda2.views.spectacle", name = "bda2-spectacle"),
    url(r'^bda/spectacles-3/$', ListView.as_view(model = Spectacle3), name ="bda3-liste-spectacles"),
    url(r'^bda/spectacles-3/unpaid$', "bda3.views.unpaid", name = "bda3-unpaid"),
    url(r'^bda/spectacles-3/(?P<spectacle_id>\d+)$', "bda3.views.spectacle", name = "bda3-spectacle"),
    url(r'^survey/(?P<survey_id>\d+)$', 'gestioncof.views.survey'),
    url(r'^event/(?P<event_id>\d+)$', 'gestioncof.views.event'),
    url(r'^survey/(?P<survey_id>\d+)/status$', 'gestioncof.views.survey_status'),
    url(r'^event/(?P<event_id>\d+)/status$', 'gestioncof.views.event_status'),
    url(r'^autocomplete/registration$', 'gestioncof.autocomplete.autocomplete'),
    url(r'^autocomplete/', include('autocomplete_light.urls')),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/(?P<app_label>[\d\w]+)/(?P<model_name>[\d\w]+)/csv/', 'gestioncof.csv_views.admin_list_export', {'fields': ['username',]}),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^grappelli/', include('grappelli.urls')),
    url(r'^utile_cof$', 'gestioncof.views.utile_cof'),
    url(r'^utile_bda$', 'gestioncof.views.utile_bda'),
    url(r'^utile_bda/bda_diff$', 'gestioncof.views.liste_bdadiff'),
    url(r'^utile_cof/diff_cof$', 'gestioncof.views.liste_diffcof'),
    url(r'^utile_bda/bda_revente$', 'gestioncof.views.liste_bdarevente'),
)
