15 # limitations under the License. |
15 # limitations under the License. |
16 |
16 |
17 """Views of a User's various Roles on the site. |
17 """Views of a User's various Roles on the site. |
18 |
18 |
19 dashboard: dashboard view of all of a User's Roles on the site |
19 dashboard: dashboard view of all of a User's Roles on the site |
|
20 |
|
21 public: a public view of the User's Roles on the site |
20 """ |
22 """ |
21 |
23 |
22 __authors__ = [ |
24 __authors__ = [ |
23 '"Todd Larsen" <tlarsen@google.com>', |
25 '"Todd Larsen" <tlarsen@google.com>', |
24 ] |
26 ] |
25 |
27 |
26 #TODO(tlarsen): this module is currently a placeholder for future work |
28 |
|
29 from google.appengine.api import users |
|
30 from django import http |
|
31 from soc.views.helpers import response_helpers |
|
32 |
|
33 |
|
34 def dashboard(request, linkname=None, |
|
35 template='soc/user/roles/dashboard.html'): |
|
36 """A per-User dashboard of that User's Roles on the site. |
|
37 |
|
38 Args: |
|
39 request: the standard django request object. |
|
40 linkname: the User's site-unique "linkname" extracted from the URL |
|
41 template: the template path to use for rendering the template. |
|
42 |
|
43 Returns: |
|
44 A subclass of django.http.HttpResponse with generated template. |
|
45 """ |
|
46 #TODO(tlarsen): this module is currently a placeholder for future work |
|
47 |
|
48 # TODO: check that user is logged in and "owns" the linkname; |
|
49 # if not, call public() view instead |
|
50 # This might be tricky, since we want to use the same style |
|
51 # of template that was passed to us, but how do we figure out |
|
52 # what the equivalent public.html template is? Perhaps this |
|
53 # view needs to require that, for a foo/bar/dashboard.html |
|
54 # template, a corresponding foo/bar/public.html template must |
|
55 # also exist... |
|
56 |
|
57 return response_helpers.respond(request, |
|
58 template, {'template': template}) |
|
59 |
|
60 |
|
61 def public(request, linkname=None, |
|
62 template='soc/user/roles/public.html'): |
|
63 """A "general public" view of a User's Roles on the site. |
|
64 |
|
65 Args: |
|
66 request: the standard django request object. |
|
67 linkname: the User's site-unique "linkname" extracted from the URL |
|
68 template: the template path to use for rendering the template. |
|
69 |
|
70 Returns: |
|
71 A subclass of django.http.HttpResponse with generated template. |
|
72 """ |
|
73 #TODO(tlarsen): this module is currently a placeholder for future work |
|
74 |
|
75 # TODO: if linkname is empty or not a vaild linkname on the site, display |
|
76 # some sort of "user does not exist" page (a custom 404 page, maybe?). |
|
77 |
|
78 return response_helpers.respond(request, |
|
79 template, {'template': template}) |
|
80 |