diff --git a/RIGS/templates/event_table.html b/RIGS/templates/event_table.html
index 94968fae..5fe01a2c 100644
--- a/RIGS/templates/event_table.html
+++ b/RIGS/templates/event_table.html
@@ -1,3 +1,4 @@
+{% load next from filters %}
{% comment %}
{% endcomment %}
@@ -90,9 +91,13 @@
{% endif %}
+ {# Insert a divider between still-out dry hires and actually upcoming events #}
+ {% with next_element=events|next:forloop.counter0 %}
+ {% if event.dry_hire == True and next_element.dry_hire == False %}
|
{%endif%}
+ {% endwith %}
{% empty %}
- | No events found |
+ No events found |
{% endfor %}
diff --git a/RIGS/templatetags/filters.py b/RIGS/templatetags/filters.py
index aaa6ac3c..f95ff0f6 100644
--- a/RIGS/templatetags/filters.py
+++ b/RIGS/templatetags/filters.py
@@ -149,3 +149,14 @@ def get_json_element(value, element):
def get_item(dictionary, key):
if(type(dictionary) is dict):
return dictionary.get(key)
+
+@register.filter
+def next(alist, current_index):
+ """
+ Returns the next element of the list using the current index if it exists.
+ Otherwise returns an empty string.
+ """
+ try:
+ return alist[int(current_index) + 1] # access the next element
+ except:
+ return '' # return empty string in case of exception