mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-25 17:32:16 +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 %}
|
{% comment %}<div class="d-none d-md-block">{% endcomment %}
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table mb-0">
|
<table class="table mb-0">
|
||||||
@@ -90,9 +91,13 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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 %}
|
{% empty %}
|
||||||
<tr class="bg-warning">
|
<tr class="bg-warning">
|
||||||
<td colspan="6">No events found</td>
|
<td colspan="4">No events found</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -149,3 +149,14 @@ def get_json_element(value, element):
|
|||||||
def get_item(dictionary, key):
|
def get_item(dictionary, key):
|
||||||
if(type(dictionary) is dict):
|
if(type(dictionary) is dict):
|
||||||
return dictionary.get(key)
|
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