- {{ actu.title }} - {{ actu.body|safe }} + {{ actu.title }} + {% if actu.is_event %} + {{ actu.chapo }} + {% else %} + {{ actu.body|safe|truncatewords_html:25 }} + {% endif %} + Lire plus >
- - {% if actu.image %} - {% image actu.image fill-400x200 class="actu-img" %} - {% endif %} - {{ actu.title }} + + {{ actu.title }} {% if actu.is_event %} - {% mini_calendar actu %}{{ actu.dates }} + {% get_current_language as curlang %} + {% mini_calendar actu curlang %}{{ actu.dates }} {% endif %} diff --git a/gestioncof/cms/templatetags/cofcms_tags.py b/gestioncof/cms/templatetags/cofcms_tags.py index c7857173..004fd21c 100644 --- a/gestioncof/cms/templatetags/cofcms_tags.py +++ b/gestioncof/cms/templatetags/cofcms_tags.py @@ -2,6 +2,7 @@ from datetime import timedelta, date from django import template from django.conf import settings from django.utils import timezone +import locale from ..models import COFActuEventPage @@ -45,7 +46,8 @@ def calendar(): day = {'day': curday.day, 'class': (('today ' if (curday.day == now.day and curday.month == now.month) else '') - + ('in' if curday.month == now.month else 'out')), + + ('in ' if curday.month == now.month else 'out') + + ('hasevent' if len(curevents) > 0 else '')), 'events': curevents} week.append(day) curday += deltaday @@ -53,7 +55,11 @@ def calendar(): return {"events": events, "weeks": weeks} @register.inclusion_tag("cofcms/mini_calendar.html") -def mini_calendar(event): +def mini_calendar(event, loc): + try: + locale.setlocale(locale.LC_TIME, loc) + except locale.Error: + pass days = [] today = timezone.now().date() date_start = event.date_start.date()