diff options
author | Madhusudan.C.S | 2011-01-30 20:06:16 +0530 |
---|---|---|
committer | Madhusudan.C.S | 2011-01-30 20:06:16 +0530 |
commit | 90724562069587c9508af2a4db87acb1e2a1b7a1 (patch) | |
tree | 61503565fba10eb8431d491c1ea7a35354270167 | |
parent | da2a5285df8c2b237942bbd6ff3cc05ccca4946c (diff) | |
download | pytask-90724562069587c9508af2a4db87acb1e2a1b7a1.tar.gz pytask-90724562069587c9508af2a4db87acb1e2a1b7a1.tar.bz2 pytask-90724562069587c9508af2a4db87acb1e2a1b7a1.zip |
Display list of tasks related to a Textbook and allow coordinator to create them.
-rwxr-xr-x | pytask/taskapp/views.py | 14 | ||||
-rw-r--r-- | pytask/templates/task/view_textbook.html | 19 |
2 files changed, 18 insertions, 15 deletions
diff --git a/pytask/taskapp/views.py b/pytask/taskapp/views.py index 04afcc3..6b30bf9 100755 --- a/pytask/taskapp/views.py +++ b/pytask/taskapp/views.py @@ -544,14 +544,15 @@ def view_textbook(request, task_id, template='task/view_textbook.html'): else: raise http.Http404 - #chapters = textbook.chapters.all() + chapters = textbook.children_tasks.all() user = request.user - context = {"user": user, - "textbook": textbook, - # "chapters": chapters, - } + context = { + 'user': user, + 'textbook': textbook, + 'chapters': chapters, + } if not user.is_authenticated(): return shortcuts.render_to_response(template, @@ -572,9 +573,10 @@ def view_textbook(request, task_id, template='task/view_textbook.html'): textbook.status in [taskapp_models.TB_STATUS_CHOICES[0][0], taskapp_models.TB_STATUS_CHOICES[1][0]]): can_edit = True + can_create_chapters = True else: can_edit = False - + can_create_chapters = False if (profile.role in [profile_models.ROLES_CHOICES[0][0], profile_models.ROLES_CHOICES[1][0]] and diff --git a/pytask/templates/task/view_textbook.html b/pytask/templates/task/view_textbook.html index 938eb8c..16f5da7 100644 --- a/pytask/templates/task/view_textbook.html +++ b/pytask/templates/task/view_textbook.html @@ -11,7 +11,7 @@ {% block content %} {% as_modification_display "Created by" textbook.created_by textbook.creation_datetime %} - <h3>{{ textbook.title }}</h3> + <h2>{{ textbook.title }}</h2> {% if can_edit %} <a href="{% url edit_textbook textbook.id %}">Edit Text book</a> @@ -24,20 +24,21 @@ <hr /> {% if textbook.tags.count %} - Tags: - {% for tag in textbook.tags %} - {{tag}} - {% endfor %} + Tags: {{ textbook.tags_field }} <hr /> {% endif %} - Chapters: <br /> + <h3> + Tasks: + {% if can_create_chapters %} + <a href="{% url create_chapter textbook.id %}">Create Tasks</a> + {% endif %} + </h3> {% if chapters %} <table> {% for chap in chapters %} <tr> - <td><a href="{% url view_task chap.id %}">{{chap.title}}</a> </td> - <td> {{chap.status}} </td> + <td><a href="{% url view_task chap.id %}">{{chap.title}}</a> </td> </tr> {% endfor %} </table> @@ -45,7 +46,7 @@ (Chapters are yet to be added by the Coordinator or T/A.)<br /> {% endif %} - <hr /> + <hr /> {% if comments %} comments:<br /><br /> {% for comment in comments %} |