homepage now displays a list of unpublished tasks
authornishanth
Fri, 26 Feb 2010 23:22:23 +0530 (2010-02-26)
changeset 125 d3cfceb8e120
parent 124 6d92b7cd2a37
child 126 e5377fdaf110
homepage now displays a list of unpublished tasks
taskapp/events/task.py
taskapp/views/user.py
templates/index.html
--- a/taskapp/events/task.py	Fri Feb 26 22:45:19 2010 +0530
+++ b/taskapp/events/task.py	Fri Feb 26 23:22:23 2010 +0530
@@ -25,7 +25,7 @@
         task.comment_set.update(is_deleted=True)
         task.comment_set.update(deleted_by=task.created_by)
 
-    task.published_datetime = datetime.datetime.now()
+    task.published_datetime = datetime.now()
 
     task.save()
     return task
--- a/taskapp/views/user.py	Fri Feb 26 22:45:19 2010 +0530
+++ b/taskapp/views/user.py	Fri Feb 26 23:22:23 2010 +0530
@@ -55,6 +55,8 @@
                    'notifications':notifications,
                    'requests':requests,
                    }
+
+        context["unpublished_tasks"] = user.task_mentors.filter(status="UP")
                    
         return render_to_response('index.html', context)
 
--- a/templates/index.html	Fri Feb 26 22:45:19 2010 +0530
+++ b/templates/index.html	Fri Feb 26 23:22:23 2010 +0530
@@ -55,8 +55,17 @@
     {% if user.task_mentors.count %}
         <br><a href="/user/mentor/">Mentoring</a> {{ user.task_mentors.count }}
         {% ifnotequal user.task_mentors.count 1 %}
-        tasks!
+            tasks!
+        {% else %}
+            task!
         {% endifnotequal %}
-        task!
+        <br />
+    {% endif %}
+    
+    {% if unpublished_tasks %}
+    <br />Unpublished tasks:<br />
+        {% for a_task in unpublished_tasks %}
+            <a href="/task/view/tid={{a_task.id}}">{{a_task.title}}</a>&nbsp;&nbsp;&nbsp;
+        {% endfor %}
     {% endif %}
 {% endblock %}