From: Yoan Le Clanche Date: Wed, 1 Sep 2021 13:15:52 +0000 (+0200) Subject: https://trackers.pilotsystems.net/prebarreau/0238 : webclass summary is now available... X-Git-Tag: 2.5.0~69 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=349d87220ef7af5862997ae3cac8d160a1d2df46;p=teleforma.git https://trackers.pilotsystems.net/prebarreau/0238 : webclass summary is now available to admin users --- diff --git a/.vscode/settings.json b/.vscode/settings.json index 839ddd71..a45c2431 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,13 @@ { - "python.pythonPath": "py_env/bin/python3" + "python.pythonPath": "py_env/bin/python3", + "prettier.disableLanguages": ["django-html"], + "beautify.language": { + "html": [ + "django-html" + ] + }, + "[django-html]": { + "editor.formatOnSave": false, + "editor.defaultFormatter": "HookyQR.beautify" + } } \ No newline at end of file diff --git a/teleforma/templates/teleforma/base.html b/teleforma/templates/teleforma/base.html index 8ebe49a5..28494ba0 100644 --- a/teleforma/templates/teleforma/base.html +++ b/teleforma/templates/teleforma/base.html @@ -122,7 +122,7 @@ {% endif %} {% endif %} - {% if user.professor.count %} + {% if user.professor.count or user.is_superuser %}
  • Webclass
  • {% endif %} diff --git a/teleforma/webclass/templates/webclass/appointments_professor.html b/teleforma/webclass/templates/webclass/appointments_professor.html index 58250e18..6031d158 100644 --- a/teleforma/webclass/templates/webclass/appointments_professor.html +++ b/teleforma/webclass/templates/webclass/appointments_professor.html @@ -15,44 +15,52 @@ Calendrier des Webclass {% block content %} - - - - - {% comment %} {% endcomment %} - - - + + + + + {% comment %} {% endcomment %} + + + {% if is_superuser %} + + {% endif %} + - {% for slot in slots %} - - - - - {% comment %} + + + + {% comment %} {% endcomment %} + + + {% if is_superuser %} + + {% endif %} + + {% empty %} + + + {% endfor %} - {% endcomment %} - - - - {% empty %} - - - - {% endfor %}
    HorairePériodeCoursIEJParticipantsSalon
    HorairePériodeCoursIEJParticipantsSalonProfesseur
    - {{slot.get_day_display}} de {{slot.start_hour|date:"H\hi"}} à {{slot.end_hour|date:"H\hi"}} - - {{slot.webclass.period.name}} - - {{slot.webclass.course.title}} - - {% for iej in slot.webclass.iej.all %} - {{iej.name}} + {% for slot in slots %} +
    + {{slot.get_day_display}} de {{slot.start_hour|date:"H\hi"}} à + {{slot.end_hour|date:"H\hi"}} + + {{slot.webclass.period.name}} + + {{slot.webclass.course.title}} + + {% for iej in slot.webclass.iej.all %} + {{iej.name}} + {% endfor %} + + {{slot.participants.count}} + + Rejoindre la conférence + {{slot.professor}}
    Aucune webclasse programmée.
    - {{slot.participants.count}} - - Rejoindre la conférence -
    Aucune webclasse programmée.
    -{% endblock content %} +{% endblock content %} \ No newline at end of file diff --git a/teleforma/webclass/views.py b/teleforma/webclass/views.py index 32702359..3cf8c1cc 100644 --- a/teleforma/webclass/views.py +++ b/teleforma/webclass/views.py @@ -24,11 +24,17 @@ class WebclassProfessorAppointments(TemplateView): self).get_context_data(**kwargs) user = self.request.user - if not user.professor: + if not user.professor.all() and not user.is_superuser: return HttpResponse('Unauthorized', status=401) today = datetime.today() - context['slots'] = WebclassSlot.published.filter( - professor=user.professor.get(), webclass__status=3, webclass__end_date__gte=today).order_by('day', 'start_hour') + query = { + 'webclass__status': 3, + 'webclass__end_date__gte': today + } + if user.professor.all(): + query['professor'] = user.professor.get() + context['slots'] = WebclassSlot.published.filter(**query).order_by('day', 'start_hour') + context['is_superuser'] = user.is_superuser return context