|
1 #!/usr/bin/python2.5 |
|
2 # |
|
3 # Copyright 2009 the Melange authors. |
|
4 # |
|
5 # Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 # you may not use this file except in compliance with the License. |
|
7 # You may obtain a copy of the License at |
|
8 # |
|
9 # http://www.apache.org/licenses/LICENSE-2.0 |
|
10 # |
|
11 # Unless required by applicable law or agreed to in writing, software |
|
12 # distributed under the License is distributed on an "AS IS" BASIS, |
|
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 # See the License for the specific language governing permissions and |
|
15 # limitations under the License. |
|
16 |
|
17 """A Django template tag library containing GHOP Task |
|
18 specific Comments helpers. |
|
19 """ |
|
20 |
|
21 __authors__ = [ |
|
22 '"Madhusudan.C.S" <madhusudancs@gmail.com>', |
|
23 ] |
|
24 |
|
25 |
|
26 from django import template |
|
27 |
|
28 |
|
29 register = template.Library() |
|
30 |
|
31 |
|
32 @register.inclusion_tag( |
|
33 'modules/ghop/templatetags/_as_ghop_task_comments.html', |
|
34 takes_context=True) |
|
35 def as_ghop_task_comment(context, comment): |
|
36 """Returns a HTML representation of a GHOP task's comments. |
|
37 """ |
|
38 |
|
39 context['comment'] = comment |
|
40 context['comment_id'] = comment.key().id_or_name() |
|
41 return context |
|
42 |
|
43 |
|
44 @register.inclusion_tag( |
|
45 'modules/ghop/templatetags/_as_ghop_task_ws.html', |
|
46 takes_context=True) |
|
47 def as_ghop_task_ws(context, comment): |
|
48 """Returns a HTML representation of a GHOP task's work submissions. |
|
49 """ |
|
50 |
|
51 context['ws'] = comment |
|
52 context['ws_id'] = comment.key().id_or_name() |
|
53 return context |