From 5cbfc554eebe492c30b9917df4fbe0331f60173e Mon Sep 17 00:00:00 2001 From: Scot Hacker Date: Sun, 11 Feb 2018 22:57:35 -0800 Subject: [PATCH] Re-enable "mine" tasks --- todo/templates/todo/list_detail.html | 3 --- todo/views.py | 11 ++++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/todo/templates/todo/list_detail.html b/todo/templates/todo/list_detail.html index 1d8ac3f..6ab8c46 100644 --- a/todo/templates/todo/list_detail.html +++ b/todo/templates/todo/list_detail.html @@ -7,8 +7,6 @@ {% if list_slug != "mine" %}
{% csrf_token %} - {# Only show task adder if list is not "mine" #} - {# fixme: Not working because need to send named form into this template. And move into a subtemplate. #}

→ Click to add task ←

@@ -95,7 +93,6 @@

- {# fixme: convert to bs buttons #} {% if list_slug != "mine" %} {% if view_completed %}

View incomplete tasks

diff --git a/todo/views.py b/todo/views.py index f44d8dc..63a95ef 100644 --- a/todo/views.py +++ b/todo/views.py @@ -88,12 +88,13 @@ def list_detail(request, list_id=None, list_slug=None, view_completed=False): """Display and manage items in a todo list. """ - task_list = get_object_or_404(TaskList, id=list_id, slug=list_slug) + if not list_slug == "mine": + task_list = get_object_or_404(TaskList, id=list_id, slug=list_slug) - # Ensure user has permission to view list. Admins can view all lists. - # Get the group this task_list belongs to, and check whether current user is a member of that group. - if task_list.group not in request.user.groups.all() and not request.user.is_staff: - raise PermissionDenied + # Ensure user has permission to view list. Admins can view all lists. + # Get the group this task_list belongs to, and check whether current user is a member of that group. + if task_list.group not in request.user.groups.all() and not request.user.is_staff: + raise PermissionDenied if request.POST: # Process completed and deleted requests on each POST