mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-18 05:52:15 +00:00
Insert a divider between still-out dry hires and actually upcoming events on rigboard
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
{% load next from filters %}
|
||||
{% comment %}<div class="d-none d-md-block">{% endcomment %}
|
||||
<div class="table-responsive">
|
||||
<table class="table mb-0">
|
||||
@@ -90,9 +91,13 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{# 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 %}<tr><td colspan="4"><hr></td><tr>{%endif%}
|
||||
{% endwith %}
|
||||
{% empty %}
|
||||
<tr class="bg-warning">
|
||||
<td colspan="6">No events found</td>
|
||||
<td colspan="4">No events found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user