Compare commits

..

No commits in common. "018b7a052f213f5dbb91483fb5715ad6ab41dc2a" and "1db30afc1af7b5763b05a773d0d052da91aa19d3" have entirely different histories.

4 changed files with 14 additions and 24 deletions

View File

@ -58,13 +58,10 @@
<footer>
<div class="buttons">
<a role="button" href="{% url 'month_view_ical' calendar.firstdate.year calendar.firstdate.month %}" >Exporter ical {% picto_from_name "calendar" %}</a>
{% if calendar.today_in_calendar %}
<a role="button" href="{% url 'aujourdhui' %}?{{ filter.get_url }}">Aujourd'hui</a>
<a role="button" href="{% url 'cette_semaine' %}?{{ filter.get_url }}">Cette semaine</a>
{% endif %}
</div>
{% if calendar.today_in_calendar %}
<a role="button" href="{% url 'aujourdhui' %}?{{ filter.get_url }}">Aujourd'hui</a>
<a role="button" href="{% url 'cette_semaine' %}?{{ filter.get_url }}">Cette semaine</a>
{% endif %}
</footer>
</article>

View File

@ -56,7 +56,7 @@ Semaine du {{ calendar.calendar_days_list.0.date|date|frdate }}
<footer>
<a role="button" href="{% url 'week_view_ical' year week %}" >Exporter ical {% picto_from_name "calendar" %}</a>
<a role="button" href="{% url 'week_view_ical' day.year day %}" >Exporter ical {% picto_from_name "calendar" %}</a>
{% if calendar.today_in_calendar %}
<a role="button" href="{% url 'aujourdhui' %}?{{ filter.get_url }}">Aujourd'hui</a>
{% endif %}

View File

@ -10,15 +10,14 @@ from .views import *
urlpatterns = [
path("", home, name="home"),
path("aujourdhui/", day_view, name="aujourdhui"),
path("jour/<int:year>/<int:month>/<int:day>/", day_view, name="day_view"),
path("jour/<int:year>/<int:month>/<int:day>?feed=ical", day_view_ical, name="day_view_ical"),
path("cette-semaine/", week_view, name="cette_semaine"),
path("semaine/<int:year>/<int:week>/", week_view, name="week_view"),
path("semaine/<int:year>/<int:week>?feed=ical", week_view_ical, name="week_view_ical"),
path("ce-mois-ci", month_view, name="ce_mois_ci"),
path("mois/<int:year>/<int:month>/", month_view, name="month_view"),
path("mois/<int:year>/<int:month>?feed=ical", month_view_ical, name="month_view_ical"),
path("jour/<int:year>/<int:month>/<int:day>/", day_view, name="day_view"),
path("jour/<int:year>/<int:month>/<int:day>?feed=ical", day_view_ical, name="day_view_ical"),
path("aujourdhui/", day_view, name="aujourdhui"),
path("cette-semaine/", week_view, name="cette_semaine"),
path("ce-mois-ci", month_view, name="ce_mois_ci"),
path("tag/<t>/", view_tag, name="view_tag"),
path("tags/", tag_list, name="view_all_tags"),
path("moderation/", moderation, name="moderation"),

View File

@ -267,10 +267,7 @@ def home(request):
return week_view(request, home=True)
def month_view_ical(request, year=None, month=None):
return month_view(request, year, month, True)
def month_view(request, year=None, month=None, ical=False):
def month_view(request, year=None, month=None):
now = date.today()
if year is None:
year = now.year
@ -280,10 +277,6 @@ def month_view(request, year=None, month=None, ical=False):
filter = EventFilter(request.GET, queryset=get_event_qs(request), request=request)
cmonth = CalendarMonth(year, month, filter)
if ical:
response = Event.export_to_ics(f"Événements {cmonth.get_month_name()} {year}", cmonth.get_events())
return response
context = {
"year": year,
"month": cmonth.get_month_name(),
@ -308,10 +301,11 @@ def week_view(request, year=None, week=None, home=False, ical=False):
cweek = CalendarWeek(year, week, filter)
if ical:
response = Event.export_to_ics(f"Événements semaine {week} {year}", cweek.get_events())
logger.warning("export ical semaine")
response = Event.export_to_ics("testsemaine", cweek.get_events())
return response
context = {"year": year, "week": week, "calendar": cweek, "filter": filter, "ical": True}
context = {"year": year, "week": week, "calendar": cweek, "filter": filter}
if home:
context["home"] = 1
return render(request, "agenda_culturel/page-week.html", context)