From 608c47baa6889891a7426f66b8e5e3f42fca1d1f Mon Sep 17 00:00:00 2001 From: Nishanth Amuluru Date: Wed, 5 Jan 2011 18:48:14 +0530 Subject: Added a page for displaying all the textbooks --- taskapp/models.py | 4 ++-- taskapp/views/task.py | 13 +++++++++++++ urls.py | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/taskapp/models.py b/taskapp/models.py index d5ad48e..19268bf 100644 --- a/taskapp/models.py +++ b/taskapp/models.py @@ -169,5 +169,5 @@ class Notification(models.Model): def __unicode__(self): return u"%s %s %s"%(self.sent_to, self.message, self.sent_date.ctime()) -tagging.register(Profile) -tagging.register(Task) +#tagging.register(Profile) +#tagging.register(Task) diff --git a/taskapp/views/task.py b/taskapp/views/task.py index 8a0c1cc..248bf4b 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -24,6 +24,19 @@ def browse_tasks(request): } return render_to_response('task/browse.html', context) +def show_textbooks(request): + """ display all the tasks """ + + user = get_user(request.user) if request.user.is_authenticated() else request.user + task_list = Task.objects.exclude(status="UP").exclude(status="DL").order_by('published_datetime').reverse() + + textbooks = task_list.filter(tags_field__icontains="textbook") + + context = {'user':user, + 'task_list':task_list, + } + return render_to_response('task/browse.html', context) + def publish_task(request, tid): """ check if user is the mentor and also if the task status is UP. """ diff --git a/urls.py b/urls.py index 4152bd1..dca8bff 100644 --- a/urls.py +++ b/urls.py @@ -58,5 +58,7 @@ urlpatterns = patterns('', (r'^user/make/(\w+)/$', userViews.change_rights), (r'^about/(\w+)/$', userViews.learn_more), + + (r'^textbook/$', taskViews.show_textbooks), ) -- cgit