Changement visuel vhc caldav

This commit is contained in:
Ambulance Clerc
2022-06-22 09:34:38 +02:00
parent c7ccb10d86
commit 13531efd74
3 changed files with 13 additions and 10 deletions

View File

@@ -25,6 +25,10 @@ class cls_caldav():
self.day = []
self.night = []
#Trie les tableau par odre croissant sur la date de début de l'événement
def sort_array(self):
self.items.sort(key=lambda x: x.dtstart, reverse=False)
def get_caldav_data(self,periode=1):
ctx = ssl.create_default_context()
ctx.check_hostname = False
@@ -78,7 +82,7 @@ class cls_caldav():
print(self.day)
print(self.night)
print(f"len={len(self.items)}")
self.sort_array()
return self.data
class _caldav_item():

View File

@@ -1,23 +1,22 @@
{% if latest_task_list %}
<table>
{% for task in latest_task_list %}
<tr>
<td style="font-weight: ;" width="100" >
<td style="padding-bottom: 15px" width="100" >
<span style="font-weight: bold;">{{task.key}}</span><br>
{{task.str_start_date}} - {{task.str_end_date}}<br>
{{task.str_start_time}} - {{task.str_end_time}}<br>
</td>&nbsp;&nbsp;&nbsp;&nbsp;
<td style="font-weight: bold;" width="75" >
{{task.key}}
</td>&nbsp;&nbsp;&nbsp;&nbsp;
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
{{ task.name }}
{{ task.name }}<br>
{{task.desc}}
</td>
</tr>
<tr><td>&nbsp;</td></tr>
{% endfor %}
</table>
{% else %}
<p>Aucune information véhicule</p>
<p>Aucune informations véhicule</p>
{% endif %}

View File

@@ -19,7 +19,7 @@ def view_task_caldav(request):
@xframe_options_exempt
def view_vhc_caldav(request):
o_caldav = cls_caldav(url="https://sync.infomaniak.com/calendars/AA01593/4f7b4591-a4c4-4443-9f78-01df068f58b8?export")
o_caldav.get_caldav_data()
o_caldav.get_caldav_data(periode=2)
template = loader.get_template("vhc/vhc_view.html")
context = {'latest_task_list': o_caldav.items}
return HttpResponse(template.render(context, request))