aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/apps/indicator/urls.py
blob: 0b5b12a31a8130c2ac1db55f0162e46ca1696b8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# -*- coding: utf-8 -*-

"""
URL configuration for apps/indicator
"""

from django.conf.urls.defaults import *

from django.views.generic import DetailView, ListView
from django.views.generic.simple import direct_to_template

from indicator import models as im



## named URLs
## for 'django.core.urlresolvers.reverse()' in 'get_absolute_url()'
urlpatterns = patterns('indicator.views',
    # IndicatorCategory, name='show-category'
    url(r'^show/category/(?P<pk>\d+)/$',
        DetailView.as_view(
            model=im.IndicatorCategory,
            template_name='show_category.html'),
        name='show-category'),
    # Indicator, name='show-indicator'
    url(r'^show/indicator/(?P<pk>\d+)/$',
        DetailView.as_view(
            model=im.Indicator,
            template_name='show_indicator.html'),
        name='show-indicator'),
    # IndicatorRecord, name='show-record'
    # TODO: howto add '@login_required'
    url(r'^show/record/(?P<pk>\d+)/$',
        DetailView.as_view(
            model=im.IndicatorRecord,
            template_name='show_record.html'),
        name='show-record'),
)


urlpatterns += patterns('indicator.views',
    ## test
    url(r'^test/$', 'test_view', name='test'),
    ## get_indicator_view
    url(r'^list/(?P<startswith>all)/$',
        'get_indicator_view', name='get_indicator_view'),
    url(r'^list/(?P<startswith>[a-zA-Z]+)/$',
        'get_indicator_view', name='get_indicator_view'),
    url(r'^category/(?P<category_id>all)/$',
        'get_indicator_view', name='get_indicator_view'),
    url(r'^category/(?P<category_id>\d+)/$',
        'get_indicator_view', name='get_indicator_view'),
    url(r'^category/(?P<category_id>all)/(?P<startswith>all)/$',
        'get_indicator_view', name='get_indicator_view'),
    url(r'^category/(?P<category_id>\d+)/(?P<startswith>all)/$',
        'get_indicator_view', name='get_indicator_view'),
    url(r'^category/(?P<category_id>all)/(?P<startswith>[a-zA-Z]+)/$',
        'get_indicator_view', name='get_indicator_view'),
    url(r'^category/(?P<category_id>\d+)/(?P<startswith>[a-zA-Z]+)/$',
        'get_indicator_view', name='get_indicator_view'),
    ## get_followed_indicator_view
    url(r'^followed/(?P<startswith>all)/$',
        'get_followed_indicator_view', name='get_followed_indicator_view'),
    url(r'^followed/(?P<startswith>[a-zA-Z]+)/$',
        'get_followed_indicator_view', name='get_followed_indicator_view'),
    url(r'^followed/category/(?P<category_id>all)/$',
        'get_followed_indicator_view', name='get_followed_indicator_view'),
    url(r'^followed/category/(?P<category_id>\d+)/$',
        'get_followed_indicator_view', name='get_followed_indicator_view'),
    ## get_unfollowed_indicator_view
    url(r'^unfollowed/(?P<startswith>all)/$',
        'get_unfollowed_indicator_view', name='get_unfollowed_indicator_view'),
    url(r'^unfollowed/(?P<startswith>[a-zA-Z]+)/$',
        'get_unfollowed_indicator_view', name='get_unfollowed_indicator_view'),
    url(r'^unfollowed/category/(?P<category_id>all)/$',
        'get_unfollowed_indicator_view', name='get_unfollowed_indicator_view'),
    url(r'^unfollowed/category/(?P<category_id>\d+)/$',
        'get_unfollowed_indicator_view', name='get_unfollowed_indicator_view'),
    ## get_record view
    url(r'^record/(?P<indicator_id>\d+)/(?P<date_range>\d{8}-\d{8})/$',
        'get_record_view', name='get_record_view'),
    url(r'^record/(?P<indicator_id>\d+)/(?P<date_range>\d{8}-\d{8})/std/$',
        'get_record_view', { 'std': True }),
    ## recommend indicator
    url(r'^recommend/indicator/(?P<number>\d+)/$',
        'recommend_indicator_view', name='recommend_indicator'),
    ## add/edit category
    url(r'^add/category/$', 'add_edit_category',
        name='add_category'),
    url(r'^edit/category/(?P<category_id>\d+)/$', 'add_edit_category',
        name='edit_category'),
    ## add/edit indicator
    url(r'^add/indicator/$', 'add_edit_indicator',
        name='add_indicator'),
    url(r'^edit/indicator/(?P<indicator_id>\d+)/$', 'add_edit_indicator',
        name='edit_indicator'),
    ## add/edit unit
    url(r'^add/unit/$', 'add_edit_unit',
        name='add_unit'),
    url(r'^edit/unit/(?P<unit_id>\d+)/$', 'add_edit_unit',
        name='edit_unit'),
    ## add/edit innateconfine
    url(r'^add/confine/$', 'add_edit_confine',
        name='add_confine'),
    url(r'^edit/confine/(?P<confine_id>\d+)/$', 'add_edit_confine',
        name='edit_confine'),
    ## add/edit record
    url(r'^add/record/$', 'add_edit_record',
        name='add_record'),
    url(r'^edit/record/(?P<record_id>\d+)/$', 'add_edit_record',
        name='edit_record'),
    ## add record history (modify history NOT allowed)
    url(r'^add/recordhistory/$', 'add_recordhistory',
        name='add_recordhistory'),
    url(r'^add/recordhistory/(?P<record_id>\d+)/$', 'add_recordhistory',
        name='add_recordhistory'),
)


urlpatterns += patterns('',
    ## done
    url(r'^done/$', direct_to_template, { 'template': 'done.html' }),
)