urls.py 3.39 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

9 10
from ckeditor.views import upload as ckeditor_upload
from ckeditor.views import browse as ckeditor_browse
fred's avatar
fred committed
11
from haystack.views import search_view_factory
fred's avatar
fred committed
12 13 14
from haystack.forms import FacetedSearchForm
from haystack.query import SearchQuerySet

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

22 23
from combo.manager.urls import urlpatterns as combo_manager_urls

24
from urls_utils import decorated_includes, cms_permission_required
25

fred's avatar
fred committed
26

27
sqs = SearchQuerySet().models(Emission, Episode, NewsItem).facet('categories').facet('tags')
28

29
urlpatterns = patterns('',
fred's avatar
fred committed
30
    url(r'^$', 'panikdb.views.home', name='home'),
31 32
    url(r'^ckeditor/upload/', login_required(ckeditor_upload)),
    url(r'^ckeditor/browse/', login_required(ckeditor_browse)),
fred's avatar
fred committed
33 34
    url(r'^search/', search_view_factory(view_class=FacetedSearchView,
        form_class=FacetedSearchForm, searchqueryset=sqs), name='haystack_search'),
35

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

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

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

fred's avatar
fred committed
44 45 46
    url(r'^nonstop/',
        decorated_includes(login_required, include(nonstop_urlpatterns))),

47
    url(r'^newsletters/add$', 'panikdb.views.newsletter_create', name='newsletter-create'),
fred's avatar
fred committed
48 49 50
    url(r'^newsletters/',
        decorated_includes(login_required, include(newsletter_urlpatterns))),

51
    url(r'^cms/',
52
        decorated_includes(cms_permission_required, include(combo_manager_urls))),
53

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

56 57 58 59 60
    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
61 62 63 64 65
    url(r'^cms/pages/(?P<page_pk>\w+)/make-topik$', 'panikdb.views.make_topik',
        name='make-topik'),
    url(r'^cms/pages/topik/(?P<pk>\w+)/edit-topik$', 'panikombo.views.topik_edit',
        name='edit-topik'),

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

69
    url(r'^combok/soundfiles/', 'panikombo.views.soundfiles'),
fred's avatar
fred committed
70
    url(r'^combok/episodes/', 'panikombo.views.episodes'),
71

fred's avatar
fred committed
72 73
    url(r'^vote/$', 'panikdb.poll.views.vote', name='vote'),
    url(r'^vote/results/$', 'panikdb.poll.views.vote_results', name='vote-results'),
fred's avatar
fred committed
74

75 76
    url(r'^admin/', include(admin.site.urls)),
)
fred's avatar
fred committed
77

fred's avatar
fred committed
78 79 80
from combo import plugins
urlpatterns = plugins.register_plugins_urls(urlpatterns)

fred's avatar
fred committed
81 82 83 84 85
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)