Re-enable "mine" tasks

This commit is contained in:
Scot Hacker 2018-02-11 22:57:35 -08:00
parent ad33d62024
commit 5cbfc554ee
2 changed files with 6 additions and 8 deletions

View file

@ -7,8 +7,6 @@
{% if list_slug != "mine" %}
<form action="" name="add_task" method="post">
{% 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. #}
<h2 id="slideToggle" >&rarr; Click to add task &larr;</h2>
<div id="AddTask">
<table class="table">
@ -95,7 +93,6 @@
<p><input type="submit" name="process_tasks" value="Continue..." class="todo-button"></p>
</form>
{# fixme: convert to bs buttons #}
{% if list_slug != "mine" %}
{% if view_completed %}
<p><a href="{% url 'todo:list_detail' list_id list_slug %}">View incomplete tasks</a></p>

View file

@ -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