urls.py 2.14 KB
Newer Older
Jean Michel Rouly's avatar
Jean Michel Rouly committed
1
2
3
4
5
## DEVELOPMENT IMPORTS
from django.conf import settings
from django.conf.urls.static import static
## DEVELOPMENT IMPORTS

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
9
10
from django.conf.urls import patterns, include, url

# 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

Jean Michel Rouly's avatar
Jean Michel Rouly committed
13
urlpatterns = patterns('website.views',
Jean Michel Rouly's avatar
Jean Michel Rouly committed
14
    # Examples:
15
16
17
    # url(r'^$', 'bookshare.views.home', name='home'),
    # url(r'^bookshare/', include('bookshare.foo.urls')),

Jean Michel Rouly's avatar
Jean Michel Rouly committed
18
    #### USER PAGES ####
Jean Michel Rouly's avatar
Jean Michel Rouly committed
19
    # user profile page
Jean Michel Rouly's avatar
Jean Michel Rouly committed
20
    url(r'^u/(?P<username>\w+)/?$', 'profile', name = 'profile'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
21
    # book listing page
Jean Michel Rouly's avatar
Jean Michel Rouly committed
22
    url(r'^u/(?P<username>\w+)/listings/(?P<book_id>\w+)$', 'listing', name = 'listing'),
23

24
    #### STATIC PAGES ####
Jean Michel Rouly's avatar
Jean Michel Rouly committed
25
26
27
28
    # home page
    url(r'^$', 'index', name = 'homepage'),
    # about page
    url(r'^about/?$', 'about', name = 'about'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
29
30
    # contact staff
    url(r'^contact/?$', 'contact', name = 'contact'),
31
32
33
    # privacy policy
    url(r'^privacy/?$', 'privacy', name = 'privacy'),

Jean Michel Rouly's avatar
Jean Michel Rouly committed
34
35
36
37
38
    #### LISTING MANAGEMENT PAGES ####
    # create new listing
    url(r'^create/?$', 'create_listing', name = 'create_listing'),
    # search for listing
    url(r'^search/?$', 'search', name = 'search'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
39
    # close listing
Jean Michel Rouly's avatar
Jean Michel Rouly committed
40
    url(r'^close/(?P<book_id>\w+)$', 'close_listing', name='close_listing'),
41
    # sell listing
Jean Michel Rouly's avatar
Jean Michel Rouly committed
42
    url(r'^sell/(?P<book_id>\w+)$', 'sell_listing', name='sell_listing'),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
43

Jean Michel Rouly's avatar
Jean Michel Rouly committed
44
    #### ADMIN PAGES ####
Jean Michel Rouly's avatar
Jean Michel Rouly committed
45
    # Uncomment the admin/doc line below to enable admin documentation:
Jean Michel Rouly's avatar
Jean Michel Rouly committed
46
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
Jean Michel Rouly's avatar
Jean Michel Rouly committed
47
    # Uncomment the next line to enable the admin:
Jean Michel Rouly's avatar
Jean Michel Rouly committed
48
    url(r'^admin/', include(admin.site.urls)),
49
50
51
52

    #### COMMENTS APP ####
    (r'^comments/', include('django.contrib.comments.urls')),

Jean Michel Rouly's avatar
Jean Michel Rouly committed
53
54
55
56
57
58
59
60
)

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'),         
)