From 054c5727b9dc553530e9b595b4d39e74aca3441a Mon Sep 17 00:00:00 2001
From: Alice Heaton <aliceh@aptivate.org>
Date: Mon, 27 Jul 2015 14:28:47 +0100
Subject: [PATCH] Add a default location when we have an action without a
 location.

---
 django/website/hid/views.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/django/website/hid/views.py b/django/website/hid/views.py
index 00f48b93..458f654c 100644
--- a/django/website/hid/views.py
+++ b/django/website/hid/views.py
@@ -168,11 +168,15 @@ class ViewItems(SingleTableView):
             it is defaulted to 'none' and placement to 'top'.
         """
         new_params = QueryDict('', mutable=True)
-        placement = re.sub('^[^-]+-', '', params.get('action', 'none-top'))
+        action = params.get('action', 'none-top')
+        if '-' in action:
+            placement = re.sub('^[^-]+-', '', action)
+            action = action[0:len(action) - len(placement) - 1]
+        else:
+            placement = 'top'
         for name, value in params.iterlists():
             if name == 'action':
-                action_name = value[0]
-                value = [action_name[0:len(action_name)-len(placement)-1]]
+                value = [action]
             elif name.endswith(placement):
                 name = name[0:len(name)-len(placement)-1]
             new_params.setlist(name, value)
-- 
GitLab