Update views.py

Fix MultipleObjects error that happens if you have multiple lists of the same name and you delete one.
This commit is contained in:
madscientistproductions 2018-12-11 17:16:13 +01:00 committed by GitHub
parent cb7b4e4c1f
commit c41d15344b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,7 +83,7 @@ def list_lists(request) -> HttpResponse:
def del_list(request, list_id: int, list_slug: str) -> HttpResponse:
"""Delete an entire list. Danger Will Robinson! Only staff members should be allowed to access this view.
"""
task_list = get_object_or_404(TaskList, slug=list_slug)
task_list = get_object_or_404(TaskList, id=list_id)
# Ensure user has permission to delete list. Admins can delete all lists.
# Get the group this list belongs to, and check whether current user is a member of that group.