from django.conf.urls.defaults import *
from django.conf import settings
import djapian
from events.models import ChronokiwiChronology, ChronokiwiEvent
from events.views import *
from events.feeds import LatestEntries

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

djapian.load_indexes()

feeds = {
    'latest': LatestEntries
}

urlpatterns = patterns('',
    (r'^$', 'events.views.index'),
    (r'^search/$', 'events.views.search'),
    (r'^chronology/$', 'events.views.chronology_list'),
    (r'^chronology/detail/(?P<chronology_id>[0-9]+)/$', 'events.views.chronology_detail'),
    (r'^event/$', 'events.views.event_list'),
    (r'^event/detail/(?P<event_id>[0-9]+)/$', 'events.views.event_detail'),
    (r'^about/$', 'events.views.about'),
    (r'^export/$', 'events.views.export'),
    url(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}, name='flurss'),

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

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

if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/devnewton/chronokiwi/media', 'show_indexes': True}),
    )