urls.py 2.06 KB
Newer Older
Daniel W Bond's avatar
Daniel W Bond committed
1
from django.conf.urls import patterns, include, url
Daniel W Bond's avatar
Daniel W Bond committed
2
from django.views.generic import TemplateView
Jean Michel Rouly's avatar
Jean Michel Rouly committed
3

Jean Michel Rouly's avatar
Jean Michel Rouly committed
4
from django.contrib import admin
Daniel W Bond's avatar
Daniel W Bond committed
5

Daniel W Bond's avatar
Daniel W Bond committed
6
7
# FIX SEARCH #
from trades.forms import StyledSearchForm
8
from haystack.views import SearchView
Jean Michel Rouly's avatar
Jean Michel Rouly committed
9
10

# Uncomment the next two lines to enable the admin:
Jean Michel Rouly's avatar
Jean Michel Rouly committed
11
admin.autodiscover()
Jean Michel Rouly's avatar
Jean Michel Rouly committed
12

Daniel W Bond's avatar
Daniel W Bond committed
13
14
handle404 = TemplateView.as_view(template_name="404.html")
handle500 = TemplateView.as_view(template_name="500.html")
15

Daniel W Bond's avatar
Daniel W Bond committed
16
urlpatterns = patterns('',
Jean Michel Rouly's avatar
Jean Michel Rouly committed
17
    #### USER PAGES ####
Daniel W Bond's avatar
Daniel W Bond committed
18
    # home page
Daniel W Bond's avatar
Daniel W Bond committed
19
    url(r'^$', TemplateView.as_view(template_name='index.html'), name = 'homepage'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
20
    # user profile page
Daniel W Bond's avatar
Daniel W Bond committed
21
    url(r'^u/(?P<username>\w+)/?$', 'website.views.profile', name = 'profile'),
22
    # create lookout
Daniel W Bond's avatar
Daniel W Bond committed
23
    url(r'^u/(?P<username>\w+)/create-lookout/?$', 'website.views.create_lookout', name = 'create_lookout'),
24
25
26

    #### LISTING PAGES ####
    # global new listings page
Daniel W Bond's avatar
Daniel W Bond committed
27
    url(r'^listings/?$', 'website.views.all_listings', name = 'all_listings'),
28
    # create new listing
Daniel W Bond's avatar
Daniel W Bond committed
29
    url(r'^listings/create/?$', 'website.views.create_listing', name = 'create_listing'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
30
    # book listing page
Daniel W Bond's avatar
Daniel W Bond committed
31
    url(r'^listings/(?P<book_id>\d+)$', 'website.views.view_listing', name = 'view_listing'),
32

33
    #### STATIC PAGES ####
Jean Michel Rouly's avatar
Jean Michel Rouly committed
34
    # about page
Daniel W Bond's avatar
Daniel W Bond committed
35
    url(r'^about/?$', TemplateView.as_view(template_name='about.html'), name='about'),
36
    # privacy policy
Daniel W Bond's avatar
Daniel W Bond committed
37
    url(r'^privacy/?$', TemplateView.as_view(template_name='privacy.html'), name='privacy'),
38
    # privacy opt-out (for piwik)
Daniel W Bond's avatar
Daniel W Bond committed
39
    url(r'^privacy/opt-out/?$', 'website.views.privacy_opt_out', name='privacy_opt_out'),
40

41
    #### SEARCH PAGES ####
Jean Michel Rouly's avatar
Jean Michel Rouly committed
42
    # points to a SearchView Instance
43
44
45
46
47
48
49
50
51
    #url(r'^search/', include('haystack.urls')),
    url(
        r'^search/?',
        SearchView(
            form_class = StyledSearchForm,
            results_per_page = 20,
        ),
        name = 'haystack_search',
    ),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
52

Daniel W Bond's avatar
Daniel W Bond committed
53
54
55
    url(r'^login/$', 'cas.views.login', name='login'),
    url(r'^logout/$', 'cas.views.logout', name='logout'),

Jean Michel Rouly's avatar
Jean Michel Rouly committed
56
    #### ADMIN PAGES ####
Daniel W Bond's avatar
Daniel W Bond committed
57
    #url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
58
    url(r'^admin/', include(admin.site.urls)),
59

Jean Michel Rouly's avatar
Jean Michel Rouly committed
60
)