# HG changeset patch # User Madhusudan.C.S # Date 1296398176 -19800 # Node ID ab9b9e59de9d9d82eac12b34a6351fa878870471 # Parent 58b9a98ffbcfa6798cf0777d49d2ba21f46d7408 Display list of tasks related to a Textbook and allow coordinator to create them. diff -r 58b9a98ffbcf -r ab9b9e59de9d pytask/taskapp/views.py --- a/pytask/taskapp/views.py Sun Jan 30 20:05:38 2011 +0530 +++ b/pytask/taskapp/views.py Sun Jan 30 20:06:16 2011 +0530 @@ -544,14 +544,15 @@ 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 @@ 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 -r 58b9a98ffbcf -r ab9b9e59de9d pytask/templates/task/view_textbook.html --- a/pytask/templates/task/view_textbook.html Sun Jan 30 20:05:38 2011 +0530 +++ b/pytask/templates/task/view_textbook.html Sun Jan 30 20:06:16 2011 +0530 @@ -11,7 +11,7 @@ {% block content %} {% as_modification_display "Created by" textbook.created_by textbook.creation_datetime %} -

{{ textbook.title }}

+

{{ textbook.title }}

{% if can_edit %} Edit Text book @@ -24,20 +24,21 @@
{% if textbook.tags.count %} - Tags: - {% for tag in textbook.tags %} - {{tag}} - {% endfor %} + Tags: {{ textbook.tags_field }}
{% endif %} - Chapters:
+

+ Tasks: + {% if can_create_chapters %} + Create Tasks + {% endif %} +

{% if chapters %} {% for chap in chapters %} - - + {% endfor %}
{{chap.title}} {{chap.status}} {{chap.title}}
@@ -45,7 +46,7 @@ (Chapters are yet to be added by the Coordinator or T/A.)
{% endif %} -
+
{% if comments %} comments:

{% for comment in comments %}