Changement visuel vhc caldav
This commit is contained in:
@@ -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():
|
||||
|
@@ -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>
|
||||
<td style="font-weight: bold;" width="75" >
|
||||
{{task.key}}
|
||||
|
||||
</td>
|
||||
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
|
||||
|
||||
{{ task.name }}
|
||||
{{ task.name }}<br>
|
||||
{{task.desc}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td> </td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p>Aucune information véhicule</p>
|
||||
<p>Aucune informations véhicule</p>
|
||||
{% endif %}
|
@@ -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))
|
Reference in New Issue
Block a user