1 | from django.conf.urls.defaults import * |
---|
2 | from django.contrib.auth.views import login, logout |
---|
3 | from django.views.generic import list_detail |
---|
4 | |
---|
5 | # Uncomment the next two lines to enable the admin: |
---|
6 | from django.contrib import admin |
---|
7 | admin.autodiscover() |
---|
8 | |
---|
9 | import settings |
---|
10 | |
---|
11 | import forms.views |
---|
12 | |
---|
13 | import groups.models |
---|
14 | |
---|
15 | urlpatterns = patterns('', |
---|
16 | # Example: |
---|
17 | # (r'^asadb/', include('asadb.foo.urls')), |
---|
18 | url( |
---|
19 | r'^$', |
---|
20 | 'django.views.generic.simple.direct_to_template', |
---|
21 | {'template': 'index.html', 'extra_context': { 'pagename':'homepage' }, }, |
---|
22 | name='homepage', |
---|
23 | ), |
---|
24 | |
---|
25 | # FYSM |
---|
26 | url( |
---|
27 | r'^fysm/submit/select/$', |
---|
28 | forms.views.select_group_fysm, |
---|
29 | name='fysm-select', |
---|
30 | ), |
---|
31 | url(r'^fysm/submit/manage/(\d+)/$', forms.views.fysm_manage, name='fysm-manage', ), |
---|
32 | url(r'^fysm/submit/thanks/(\d+)/$', forms.views.fysm_thanks, name='fysm-thanks', ), |
---|
33 | url(r'^fysm/(\d+)/view/(\d+)/$', forms.views.fysm_view, name='fysm-view', ), |
---|
34 | url(r'^fysm/(\d+)/(join|website)/(\d+)/$', forms.views.fysm_link, name='fysm-link', ), |
---|
35 | url(r'^fysm/(?:(\d+)/)?(?:([\w-]+)/)?$', forms.views.fysm_by_years, name='fysm', ), |
---|
36 | |
---|
37 | # Group list |
---|
38 | url( |
---|
39 | r'^groups/$', |
---|
40 | list_detail.object_list, |
---|
41 | { |
---|
42 | 'queryset': groups.models.Group.objects.all(), |
---|
43 | 'template_object_name': 'group', |
---|
44 | 'extra_context': {'pagename': 'groups', }, |
---|
45 | }, |
---|
46 | name='group-list', |
---|
47 | ), |
---|
48 | |
---|
49 | # Uncomment the admin/doc line below and add 'django.contrib.admindocs' |
---|
50 | # to INSTALLED_APPS to enable admin documentation: |
---|
51 | # (r'^admin/doc/', include('django.contrib.admindocs.urls')), |
---|
52 | |
---|
53 | # Uncomment the next line to enable the admin: |
---|
54 | (r'^admin/', include(admin.site.urls)), |
---|
55 | url(r'^accounts/login/', 'mit.scripts_login', name='login', ), |
---|
56 | url(r'^accounts/logout/', logout, name='logout', ), |
---|
57 | ) |
---|
58 | |
---|
59 | if settings.DEBUG: |
---|
60 | print "In debug mode; enabling static media serving" |
---|
61 | from django.views.static import serve |
---|
62 | _media_url = settings.MEDIA_URL |
---|
63 | if _media_url.startswith('/'): |
---|
64 | _media_url = _media_url[1:] |
---|
65 | urlpatterns += patterns('', |
---|
66 | (r'^%s(?P<path>.*)$' % _media_url, |
---|
67 | serve, |
---|
68 | {'document_root': settings.MEDIA_ROOT})) |
---|
69 | del(_media_url, serve) |
---|