From 1ac5b4aeb172b884ca5ec835f9e225d80a8ec30a Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Sun, 14 Apr 2019 15:12:11 -0400 Subject: [PATCH] Fix NoReverseMatch on demo page for superuser Currently if a superuser accesses any of the demo pages, the Django server crashes with a NoReverseMatch as shown in the screenshot below: ![Screenshot showing NoReverseMatch crash](https://user-images.githubusercontent.com/1086421/56097854-a5857300-5ec7-11e9-9782-a0274d01a1ac.png) This is caused by the fact that the demo pages re-use the annotation base template. When the user is a superuser, the annotation base template includes a link to edit the current project id. However, demo projects don't have an id which causes the crash. This change fixes the crash by only including the project edit link if the Django context contains a project id. --- app/server/templates/annotation/annotation_base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/server/templates/annotation/annotation_base.html b/app/server/templates/annotation/annotation_base.html index 3b4f1fde..ae63b951 100644 --- a/app/server/templates/annotation/annotation_base.html +++ b/app/server/templates/annotation/annotation_base.html @@ -4,7 +4,7 @@ {% endblock %} {% block navigation %} -{% if user.is_superuser %} +{% if user.is_superuser and 'project_id' in view.kwargs %}