From e9004a62e6038d96612d4349a5105400566c988b Mon Sep 17 00:00:00 2001 From: Josue Kouka Date: Wed, 17 May 2017 18:19:07 +0200 Subject: [PATCH] add calendar cell model (#16393) --- combo/apps/chrono/README | 4 + combo/apps/chrono/__init__.py | 28 +++++ combo/apps/chrono/forms.py | 68 ++++++++++++ combo/apps/chrono/migrations/0001_initial.py | 43 ++++++++ combo/apps/chrono/migrations/__init__.py | 0 combo/apps/chrono/models.py | 68 ++++++++++++ combo/apps/chrono/templates/__init__.py | 0 .../chrono/templates/chrono/calendar_cell.html | 12 +++ .../templates/chrono/includes/calendar_table.html | 55 ++++++++++ combo/apps/chrono/templatetags/__init__.py | 0 combo/apps/chrono/templatetags/chrono.py | 48 +++++++++ combo/apps/chrono/urls.py | 24 +++++ combo/apps/chrono/utils.py | 118 +++++++++++++++++++++ combo/apps/chrono/views.py | 61 +++++++++++ combo/settings.py | 1 + tests/test_calendar.py | 97 +++++++++++++++++ 16 files changed, 627 insertions(+) create mode 100644 combo/apps/chrono/README create mode 100644 combo/apps/chrono/__init__.py create mode 100644 combo/apps/chrono/forms.py create mode 100644 combo/apps/chrono/migrations/0001_initial.py create mode 100644 combo/apps/chrono/migrations/__init__.py create mode 100644 combo/apps/chrono/models.py create mode 100644 combo/apps/chrono/templates/__init__.py create mode 100644 combo/apps/chrono/templates/chrono/calendar_cell.html create mode 100644 combo/apps/chrono/templates/chrono/includes/calendar_table.html create mode 100644 combo/apps/chrono/templatetags/__init__.py create mode 100644 combo/apps/chrono/templatetags/chrono.py create mode 100644 combo/apps/chrono/urls.py create mode 100644 combo/apps/chrono/utils.py create mode 100644 combo/apps/chrono/views.py create mode 100644 tests/test_calendar.py diff --git a/combo/apps/chrono/README b/combo/apps/chrono/README new file mode 100644 index 0000000..9c206de --- /dev/null +++ b/combo/apps/chrono/README @@ -0,0 +1,4 @@ +Combo calendar cell +=================== + +To be visible, this cell needs a 'chrono' entry in settings.KNOWN_SERVICES diff --git a/combo/apps/chrono/__init__.py b/combo/apps/chrono/__init__.py new file mode 100644 index 0000000..feef274 --- /dev/null +++ b/combo/apps/chrono/__init__.py @@ -0,0 +1,28 @@ +# combo - content management system +# Copyright (C) 2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.chrono' + + def get_before_urls(self): + from . import urls + return urls.urlpatterns + + +default_app_config = 'combo.apps.chrono.AppConfig' diff --git a/combo/apps/chrono/forms.py b/combo/apps/chrono/forms.py new file mode 100644 index 0000000..11223b7 --- /dev/null +++ b/combo/apps/chrono/forms.py @@ -0,0 +1,68 @@ +# combo - content management system +# Copyright (C) 2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from django import forms +from django.utils.translation import ugettext_lazy as _ + +from .models import CalendarCell +from .utils import (get_agendas, get_formsdef, + is_datetime_diff_valid) + + +class CalendarCellForm(forms.ModelForm): + + class Meta: + model = CalendarCell + fields = ( + 'title', 'agenda_reference', 'formdef_reference', + 'formdef_url_params', 'slot_duration', 'minimal_event_duration', + 'business_hour_start', 'business_hour_start') + + def __init__(self, *args, **kwargs): + super(CalendarCellForm, self).__init__(*args, **kwargs) + agenda_references = get_agendas() + formdef_references = get_formsdef() + self.fields['agenda_reference'].widget = forms.Select(choices=agenda_references) + self.fields['formdef_reference'].widget = forms.Select(choices=formdef_references) + + +class BookingForm(forms.Form): + + def __init__(self, *args, **kwargs): + self.cell = kwargs.pop('cell') + super(BookingForm, self).__init__(*args, **kwargs) + + def is_valid(self): + # assure that at least slot is selected + if len(self.data.keys()) == 1: + raise ValueError(_('Please select slots')) + # check that selected slots are part of the same day + if len(self.data.keys()) > 2: + raise ValueError(_('Please select slot from the same day')) + data = {} + for key in self.data.keys(): + if key == 'csrfmiddlewaretoken': + continue + values = self.data.getlist(key) + data['start'] = values[0] + data['end'] = values[-1] + + # check that booking duration is above minimum limitation + if not is_datetime_diff_valid(data['end'], data['start'], self.cell.minimal_event_duration): + raise ValueError(_( + 'Minimal booking duration is %s' % self.cell.minimal_event_duration.strftime('%H:%M'))) + self.cleaned_data = data + return True diff --git a/combo/apps/chrono/migrations/0001_initial.py b/combo/apps/chrono/migrations/0001_initial.py new file mode 100644 index 0000000..9d99dd2 --- /dev/null +++ b/combo/apps/chrono/migrations/0001_initial.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import jsonfield.fields +import datetime + + +class Migration(migrations.Migration): + + dependencies = [ + ('auth', '0006_require_contenttypes_0002'), + ('data', '0025_jsoncell_varnames_str'), + ] + + operations = [ + migrations.CreateModel( + name='CalendarCell', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('placeholder', models.CharField(max_length=20)), + ('order', models.PositiveIntegerField()), + ('slug', models.SlugField(verbose_name='Slug', blank=True)), + ('extra_css_class', models.CharField(max_length=100, verbose_name='Extra classes for CSS styling', blank=True)), + ('public', models.BooleanField(default=True, verbose_name='Public')), + ('restricted_to_unlogged', models.BooleanField(default=False, verbose_name='Restrict to unlogged users')), + ('last_update_timestamp', models.DateTimeField(auto_now=True)), + ('title', models.CharField(max_length=128, verbose_name='Title')), + ('agenda_reference', models.URLField(verbose_name='Events source URL')), + ('formdef_reference', models.URLField(verbose_name='Application form URL')), + ('formdef_url_params', jsonfield.fields.JSONField(default=dict, help_text='{{start}} will take booking start datetime and {{end}} will take booking end datetime', verbose_name='Session vars')), + ('slot_duration', models.TimeField(default=datetime.time(0, 30), verbose_name='Slot duration')), + ('minimal_event_duration', models.TimeField(default=datetime.time(2, 0), verbose_name='Minimal event duration')), + ('business_hour_start', models.TimeField(default=datetime.time(8, 0), verbose_name='Business hour start')), + ('business_hour_end', models.TimeField(default=datetime.time(18, 0), verbose_name='Business hour end')), + ('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)), + ('page', models.ForeignKey(to='data.Page')), + ], + options={ + 'verbose_name': 'Calendar', + }, + ), + ] diff --git a/combo/apps/chrono/migrations/__init__.py b/combo/apps/chrono/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/combo/apps/chrono/models.py b/combo/apps/chrono/models.py new file mode 100644 index 0000000..829e473 --- /dev/null +++ b/combo/apps/chrono/models.py @@ -0,0 +1,68 @@ +# combo - content management system +# Copyright (C) 2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from django.db import models +from django.utils.translation import ugettext_lazy as _ +from django.utils.dateparse import parse_time +from django.utils.text import slugify + +from combo.data.models import CellBase +from combo.data.library import register_cell_class +from .utils import is_chrono_enabled, get_chrono_events + +from jsonfield import JSONField + + +@register_cell_class +class CalendarCell(CellBase): + + title = models.CharField(_('Title'), max_length=128) + agenda_reference = models.URLField(_('Events source URL')) + formdef_reference = models.URLField(_('Application form URL')) + formdef_url_params = JSONField(_('Session vars'), + help_text=_("{{start}} will take booking start datetime and {{end}} will take booking end datetime")) + slot_duration = models.TimeField( + _('Slot duration'), default=parse_time('00:30')) + minimal_event_duration = models.TimeField( + _('Minimal event duration'), default=parse_time('02:00')) + business_hour_start = models.TimeField( + _('Business hour start'), default=parse_time('08:00')) + business_hour_end = models.TimeField( + _('Business hour end'), default=parse_time('18:00')) + + template_name = 'chrono/calendar_cell.html' + + class Meta: + verbose_name = _('Calendar') + + def get_default_form_class(self): + from .forms import CalendarCellForm + return CalendarCellForm + + @classmethod + def is_enabled(cls): + return is_chrono_enabled() + + def save(self, *args, **kwargs): + if not self.slug: + self.slug = slugify(self.title) + return super(CalendarCell, self).save(*args, **kwargs) + + def get_calendar(self): + return get_chrono_events(self.agenda_reference) + + def render(self, context): + return super(CalendarCell, self).render(context) diff --git a/combo/apps/chrono/templates/__init__.py b/combo/apps/chrono/templates/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/combo/apps/chrono/templates/chrono/calendar_cell.html b/combo/apps/chrono/templates/chrono/calendar_cell.html new file mode 100644 index 0000000..ba81a3b --- /dev/null +++ b/combo/apps/chrono/templates/chrono/calendar_cell.html @@ -0,0 +1,12 @@ +{% load i18n chrono %} + +
+

{{cell.title}}

+
+ {% block calendar_table %} + {% calendar_table cell=cell %} + {% endblock %} +
+
+ + diff --git a/combo/apps/chrono/templates/chrono/includes/calendar_table.html b/combo/apps/chrono/templates/chrono/includes/calendar_table.html new file mode 100644 index 0000000..fed2c50 --- /dev/null +++ b/combo/apps/chrono/templates/chrono/includes/calendar_table.html @@ -0,0 +1,55 @@ +{% load i18n %} + +
+{% if calendar.has_other_pages %} +

+{% if calendar.has_previous %} +{% trans "previews week" %} +{% else %} +<< +{% endif %} +  + + {{ calendar.number }} / {{ calendar.paginator.num_pages }} + +  +{% if calendar.has_next %} +{% trans "next week" %} +{% else %} +>> +{% endif %} +

+{% endif %} + + +
+
+ {% csrf_token %} + + + {% if calendar_table_headers %} + + {% for header in calendar_table_headers %} + + {% endfor %} + + {% endif %} + + + {% for week, slots in calendar %} + {% for slot, choices in slots.items %} + + {% for choice in choices %} + + {% endfor %} + + {% endfor %} + {% endfor %} + +
{{header}}
+ + +
+ +
+
diff --git a/combo/apps/chrono/templatetags/__init__.py b/combo/apps/chrono/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/combo/apps/chrono/templatetags/chrono.py b/combo/apps/chrono/templatetags/chrono.py new file mode 100644 index 0000000..3b4d8f5 --- /dev/null +++ b/combo/apps/chrono/templatetags/chrono.py @@ -0,0 +1,48 @@ +# combo - content management system +# Copyright (C) 2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from django import template +from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger + +from combo.apps.chrono.utils import get_calendar + +register = template.Library() + + +@register.inclusion_tag('chrono/includes/calendar_table.html', takes_context=True) +def calendar_table(context, cell): + request = context['request'] + page = request.GET.get('week_%s' % cell.slug, 1) + # get calendar + calendar = get_calendar(cell.get_calendar()) + + paginator = Paginator(tuple(calendar.items()), 1) + try: + calendar = paginator.page(page) + except PageNotAnInteger: + calendar = paginator.page(1) + except (EmptyPage,): + calendar = paginator.page(paginator.num_pages) + + # build calendar tablle headers + if calendar.object_list: + calendar_table_headers = [] + for choice in calendar.object_list[0][1].values()[0]: + calendar_table_headers.append(choice['label']) + context['calendar_table_headers'] = calendar_table_headers + + context['calendar'] = calendar + return context diff --git a/combo/apps/chrono/urls.py b/combo/apps/chrono/urls.py new file mode 100644 index 0000000..78640ab --- /dev/null +++ b/combo/apps/chrono/urls.py @@ -0,0 +1,24 @@ +# combo - content management system +# Copyright (C) 2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from django.conf.urls import url + +from .views import EventsView, BookingView + +urlpatterns = [ + url(r'^api/chrono/events/(?P[\w,-]+)/', EventsView.as_view(), name='chrono-events'), + url(r'^api/chrono/book/(?P[\w,-]+)/', BookingView.as_view(), name='chrono-booking'), +] diff --git a/combo/apps/chrono/utils.py b/combo/apps/chrono/utils.py new file mode 100644 index 0000000..79e2034 --- /dev/null +++ b/combo/apps/chrono/utils.py @@ -0,0 +1,118 @@ +# combo - content management system +# Copyright (C) 2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +import json +from collections import OrderedDict +import datetime + + +from django.conf import settings +from django.utils.dateparse import parse_datetime +from django.utils import formats +from django.template import Context, Template + +from combo.utils import requests + + +def get_service(service_name): + if hasattr(settings, 'KNOWN_SERVICES') and settings.KNOWN_SERVICES.get(service_name): + return settings.KNOWN_SERVICES[service_name].values()[0] + + +def get_chrono_service(): + return get_service('chrono') + + +def get_wcs_service(): + return get_service('wcs') + + +def is_chrono_enabled(): + return get_chrono_service() + + +def get_agendas(): + chrono = get_chrono_service() + url = chrono['url'] + 'api/agenda/' + response = requests.get(url, headers={'accept': 'application/json'}) + data = response.json() + agendas = [(item['api']['datetimes_url'], item['text']) for item in data['data']] + return agendas + + +def get_formsdef(): + wcs = get_wcs_service() + url = wcs['url'] + '/api/formdefs/' + response = requests.get(url, headers={'accept': 'application/json'}) + data = response.json() + forms = [(item['url'], item['title']) for item in data] + return forms + + +def get_chrono_events(chrono_url, **kwargs): + response = requests.get( + chrono_url, + headers={'accept': 'application/json'}, + **kwargs) + return response.json().get('data', []) + + +def get_day_time_slots(start, end, offset): + dstart = start + # offset in minute + offset = offset.hour * 60 + offset.minute + while dstart <= end: + yield dstart.strftime('%H:%M') + dstart = datetime.datetime.combine( + datetime.date.today(), dstart) + datetime.timedelta(minutes=offset) + dstart = dstart.time() + + +def get_calendar(events): + calendar = {} + for event in events: + human_day = formats.date_format(parse_datetime(event['datetime']).date()) + event_datetime = parse_datetime(event['datetime']) + event_time = event_datetime.strftime('%H:%M') + # get week ref + week_ref = event_datetime.isocalendar()[1] + if week_ref not in calendar: + calendar[week_ref] = {} + if event_time not in calendar[week_ref]: + calendar[week_ref][event_time] = [] + choice = {} + choice['value'] = event_datetime.isoformat() + choice['label'] = human_day + # add disabled if no more slot available for that day + choice['disabled'] = 'disabled' if event.get('disabled', False) else '' + calendar[week_ref][event_time].append(choice) + # sort days + for week in calendar: + calendar[week] = OrderedDict(sorted(calendar[week].items())) + # sort weeks + calendar = OrderedDict(sorted(calendar.items())) + return calendar + + +def build_session_vars(cell, data): + tpl = Template(json.dumps(cell.formdef_url_params)) + session_vars = json.loads(tpl.render(Context(data))) + return session_vars + + +def is_datetime_diff_valid(end, start, valid): + end = parse_datetime(end) + start = parse_datetime(start) + return (end - start) >= datetime.timedelta(hours=valid.hour) diff --git a/combo/apps/chrono/views.py b/combo/apps/chrono/views.py new file mode 100644 index 0000000..e513e1f --- /dev/null +++ b/combo/apps/chrono/views.py @@ -0,0 +1,61 @@ +# combo - content management system +# Copyright (C) 2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import urllib + +from django.http import HttpResponseRedirect, JsonResponse +from django.views.decorators.csrf import csrf_exempt +from django.views.generic import View +from django.views.generic.detail import SingleObjectMixin +from django.contrib import messages + +from .models import CalendarCell +from .utils import get_chrono_events, build_session_vars +from .forms import BookingForm + + +class EventsView(SingleObjectMixin, View): + + http_method_names = ['get'] + model = CalendarCell + + def get(self, request, *args, **kwargs): + cell = self.get_object() + data = get_chrono_events(cell.agenda_reference) + return JsonResponse(data, safe=False) + + +class BookingView(SingleObjectMixin, View): + + http_method_names = ['post'] + model = CalendarCell + + @csrf_exempt + def dispatch(self, request, *args, **kwargs): + return super(BookingView, self).dispatch(request, *args, **kwargs) + + def post(self, request, *args, **kwargs): + cell = self.get_object() + form = BookingForm(request.POST, cell=cell) + try: + form.is_valid() + except ValueError as exc: + messages.error(request, exc.message) + return HttpResponseRedirect(cell.page.get_online_url()) + data = form.cleaned_data + params = build_session_vars(cell, data) + url = '%s?%s' % (cell.formdef_reference, urllib.urlencode(params)) + return HttpResponseRedirect(url) diff --git a/combo/settings.py b/combo/settings.py index 0f0247d..e631696 100644 --- a/combo/settings.py +++ b/combo/settings.py @@ -75,6 +75,7 @@ INSTALLED_APPS = ( 'combo.apps.notifications', 'combo.apps.search', 'combo.apps.usersearch', + 'combo.apps.chrono', 'haystack', 'xstatic.pkg.chartnew_js', ) diff --git a/tests/test_calendar.py b/tests/test_calendar.py new file mode 100644 index 0000000..640dfce --- /dev/null +++ b/tests/test_calendar.py @@ -0,0 +1,97 @@ +import json +import urlparse + +import pytest +import mock + +from django.utils.dateparse import parse_time + +from combo.data.models import Page +from combo.apps.chrono.models import CalendarCell + +pytestmark = pytest.mark.django_db + +CHRONO_EVENTS = { + "data": [ + { + "disabled": True, + "text": "19 mai 2017 08:00", + "api": { + "fillslot_url": "http://example.net/api/agenda/whatever/fillslot/86/" + }, + "id": 86, + "datetime": "2017-05-19 08:00:00" + }, + { + "disabled": True, + "text": "19 mai 2017 08:30", + "api": { + "fillslot_url": "http://example.net/api/agenda/whatever/fillslot/87/" + }, + "id": 87, + "datetime": "2017-05-19 08:30:00" + }, + { + "disabled": True, + "text": "19 mai 2017 09:00", + "api": { + "fillslot_url": "http://example.net/api/agenda/whatever/fillslot/88/" + }, + "id": 88, + "datetime": "2017-05-19 09:00:00" + }, + { + "disabled": True, + "text": "19 mai 2017 09:30", + "api": { + "fillslot_url": "http://example.net/api/agenda/whatever/fillslot/89/" + }, + "id": 89, + "datetime": "2017-05-19 09:30:00" + } + ] +} + + +class MockedRequestResponse(mock.Mock): + + def json(self): + return json.loads(self.content) + + +@pytest.fixture +def cell(db): + page = Page.objects.create() + cell = CalendarCell( + page=page, title='Example Of Calendar', order=1, + agenda_reference='http://example.net/api/events/', + formdef_reference='http://example.net/form/whatever/', + formdef_url_params={ + "session_var_start_dt": "{{start}}", "session_var_end_dt": "{{end}}", + "session_var_whatever_slug": "whatever" + }, + slot_duration=parse_time('00:30'), + business_hour_start=parse_time('08:00'), + business_hour_end=parse_time('18:00'), + minimal_event_duration=parse_time('00:30') + ) + cell.save() + return cell + + +@mock.patch('combo.apps.chrono.utils.requests.get') +def test_get_events(mocked_get, app, cell): + mocked_get.return_value = MockedRequestResponse(content=json.dumps(CHRONO_EVENTS)) + resp = app.get('/api/chrono/events/%s/' % cell.pk) + assert len(resp.json) == 4 + + +def test_redirection_session_vars(app, cell, settings): + params = {'19 Mai 2017': ['2017-05-19T10:30:23', '2017-05-19T12:30:14'], + 'csrfmiddleware': 'shgfsufysgfjsvfhsvfgv'} + resp = app.post('/api/chrono/book/%s/' % cell.pk, params=params, status=302) + parsed = urlparse.urlparse(resp.url) + qs = urlparse.parse_qs(parsed.query) + assert qs['session_var_whatever_slug'] == ['whatever'] + assert qs['session_var_start_dt'] == [params['19 Mai 2017'][0]] + assert qs['session_var_end_dt'] == [params['19 Mai 2017'][1]] -- 2.11.0