urls.py 2.28 KB
Newer Older
Jean Michel Rouly's avatar
Jean Michel Rouly committed
1
2
from django.conf import settings
from django.conf.urls.static import static
Daniel W Bond's avatar
Daniel W Bond committed
3
4

from django.views.generic import TemplateView
Jean Michel Rouly's avatar
Jean Michel Rouly committed
5

Jean Michel Rouly's avatar
Jean Michel Rouly committed
6
from django.contrib import admin
Jean Michel Rouly's avatar
Jean Michel Rouly committed
7
from django.contrib import auth
Jean Michel Rouly's avatar
Jean Michel Rouly committed
8
from django.conf.urls import patterns, include, url
9
10
from website.forms import StyledSearchForm
from haystack.views import SearchView
Jean Michel Rouly's avatar
Jean Michel Rouly committed
11
12

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

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

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

    #### LISTING PAGES ####
    # global new listings page
    url(r'^listings/?$', 'all_listings', name = 'all_listings'),
    # create new listing
    url(r'^listings/create/?$', 'create_listing', name = 'create_listing'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
32
    # book listing page
33
    url(r'^listings/(?P<book_id>\d+)$', 'view_listing', name = 'view_listing'),
34

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

45
    #### SEARCH PAGES ####
Jean Michel Rouly's avatar
Jean Michel Rouly committed
46
    # points to a SearchView Instance
47
48
49
50
51
52
53
54
55
    #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
56

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

Jean Michel Rouly's avatar
Jean Michel Rouly committed
61
62
)

Jean Michel Rouly's avatar
Jean Michel Rouly committed
63
64
65
66
67
urlpatterns += patterns('django.contrib.auth.views',
    #### AUTH PAGES ####
    url(r'^login$', 'login', {'template_name': 'login.html'},
        name='website_login'),
    url(r'^logout$', 'logout', {'next_page': '/'}, name='website_logout'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
68
)