urls.py 2.71 KB
Newer Older
1
from django.conf.urls import patterns, include, url
fred's avatar
fred committed
2
from django.conf import settings
fred's avatar
fred committed
3 4
from django.views.generic import RedirectView
from django.core.urlresolvers import reverse_lazy
5
from django.contrib.auth.decorators import login_required
6 7 8

from django.contrib import admin

fred's avatar
fred committed
9
from haystack.views import search_view_factory
fred's avatar
fred committed
10 11 12
from haystack.forms import FacetedSearchForm
from haystack.query import SearchQuerySet

fred's avatar
fred committed
13
from emissions.views import FacetedSearchView
fred's avatar
fred committed
14
from emissions.urls import urlpatterns as emissions_urlpatterns
15
from emissions.models import Emission, Episode, NewsItem
16
from newsletter.urls import management_patterns as newsletter_urlpatterns
fred's avatar
fred committed
17
from matos.urls import urlpatterns as matos_urlpatterns
fred's avatar
fred committed
18
from nonstop.urls import urlpatterns as nonstop_urlpatterns
19

20 21
from combo.manager.urls import urlpatterns as combo_manager_urls

22
from urls_utils import decorated_includes, cms_permission_required
23

fred's avatar
fred committed
24

25
sqs = SearchQuerySet().models(Emission, Episode, NewsItem).facet('categories').facet('tags')
26

27
urlpatterns = patterns('',
fred's avatar
fred committed
28
    url(r'^$', 'panikdb.views.home', name='home'),
29
    (r'^ckeditor/', include('ckeditor.urls')),
fred's avatar
fred committed
30 31
    url(r'^search/', search_view_factory(view_class=FacetedSearchView,
        form_class=FacetedSearchForm, searchqueryset=sqs), name='haystack_search'),
32

fred's avatar
fred committed
33
    url(r'^emissions/$', 'panikdb.views.emissions_list', name='emission-list'),
34 35 36 37

    url(r'^emissions/',
        decorated_includes(login_required, include(emissions_urlpatterns))),

fred's avatar
fred committed
38 39 40
    url(r'^matos/',
        decorated_includes(login_required, include(matos_urlpatterns))),

fred's avatar
fred committed
41 42 43
    url(r'^nonstop/',
        decorated_includes(login_required, include(nonstop_urlpatterns))),

44
    url(r'^newsletters/add$', 'panikdb.views.newsletter_create', name='newsletter-create'),
45 46 47
    url(r'^newsletters/',
        decorated_includes(login_required, include(newsletter_urlpatterns))),

48
    url(r'^cms/',
49
        decorated_includes(cms_permission_required, include(combo_manager_urls))),
50

fred's avatar
fred committed
51 52
    url(r'^news/$', 'panikdb.views.news', name='news-list'),

53 54 55 56 57
    url(r'^focus/set/(?P<object_type>[\w,-]+)/(?P<object_id>\d+)$',
        'panikdb.views.focus_set', name='focus-set'),
    url(r'^focus/unset/(?P<object_type>[\w,-]+)/(?P<object_id>\d+)$',
        'panikdb.views.focus_unset', name='focus-unset'),

fred's avatar
fred committed
58
    url(r'^accounts/logout/', 'django.contrib.auth.views.logout_then_login', name='logout'),
59
    url(r'^accounts/', include('registration.backends.default.urls')),
60

61 62
    url(r'^combok/soundfiles/', 'panikombo.views.soundfiles'),

63 64
    url(r'^admin/', include(admin.site.urls)),
)
fred's avatar
fred committed
65 66 67 68 69 70

from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()

from django.conf.urls.static import static
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)