Statistiques + messages

This commit is contained in:
Evarin 2017-06-27 23:14:24 +02:00
parent a74f3de910
commit f4ba29224e
7 changed files with 213 additions and 113 deletions

View file

@ -239,6 +239,10 @@ section.content.recherche {
}
}
}
ul.messages {
display: none;
}
}
@media screen and (max-width: 500px), screen and (max-width: 800px) and (orientation: portrait) {

View file

@ -141,6 +141,24 @@ header {
h1 {
margin-bottom: 0.6em;
}
ul.messages {
margin: -20px;
margin-bottom: 15px;
li {
background: #ccc;
color: #333;
padding: 5px 10px;
font-weight: bold;
font-size: 0.8em;
&.success {
background-color: darken($fond, 10%);
color: #fff;
}
}
}
}
// Liste des stages condensée sur le profil

View file

@ -210,30 +210,48 @@ header h1 {
.content h1 {
margin-bottom: 0.6em;
}
/* line 146, ../../sass/screen.scss */
.content ul.messages {
margin: -20px;
margin-bottom: 15px;
}
/* line 149, ../../sass/screen.scss */
.content ul.messages li {
background: #ccc;
color: #333;
padding: 5px 10px;
font-weight: bold;
font-size: 0.8em;
}
/* line 156, ../../sass/screen.scss */
.content ul.messages li.success {
background-color: #72a329;
color: #fff;
}
/* line 167, ../../sass/screen.scss */
.condensed-stages li {
display: table;
width: 100%;
background: #fff;
margin: 12px;
}
/* line 156, ../../sass/screen.scss */
/* line 174, ../../sass/screen.scss */
.condensed-stages li > *, .condensed-stages li:before {
display: table-cell;
vertical-align: middle;
padding: 15px;
}
/* line 161, ../../sass/screen.scss */
/* line 179, ../../sass/screen.scss */
.condensed-stages li a {
width: auto;
}
/* line 163, ../../sass/screen.scss */
/* line 181, ../../sass/screen.scss */
.condensed-stages li a:hover {
background: #e08206;
color: #fff;
}
/* line 168, ../../sass/screen.scss */
/* line 186, ../../sass/screen.scss */
.condensed-stages li:before {
content: "";
text-align: right;
@ -241,73 +259,73 @@ header h1 {
opacity: 0.8;
color: #000;
}
/* line 175, ../../sass/screen.scss */
/* line 193, ../../sass/screen.scss */
.condensed-stages li.stage-brouillon:before {
content: "Brouillon";
background: #f93a93;
}
/* line 179, ../../sass/screen.scss */
/* line 197, ../../sass/screen.scss */
.condensed-stages li.stage-publie:before {
content: "Publié";
background: #419be9;
}
/* line 183, ../../sass/screen.scss */
/* line 201, ../../sass/screen.scss */
.condensed-stages li.stage-ajout:before {
content: "+";
color: #000;
}
/* line 191, ../../sass/screen.scss */
/* line 209, ../../sass/screen.scss */
.stage-liste li {
display: block;
position: relative;
}
/* line 195, ../../sass/screen.scss */
/* line 213, ../../sass/screen.scss */
.stage-liste li.date-maj {
font-weight: 300;
font-size: 0.9em;
padding: 3px 0;
font-style: italic;
}
/* line 201, ../../sass/screen.scss */
/* line 219, ../../sass/screen.scss */
.stage-liste li.stage {
padding: 10px;
background: #fff;
margin: 10px;
border-left: 5px solid #f99b20;
}
/* line 207, ../../sass/screen.scss */
/* line 225, ../../sass/screen.scss */
.stage-liste li.stage h3 {
font-size: 1.4em;
padding-left: 5px;
}
/* line 211, ../../sass/screen.scss */
/* line 229, ../../sass/screen.scss */
.stage-liste li.stage h3 > a {
color: #0f4c82;
}
/* line 215, ../../sass/screen.scss */
/* line 233, ../../sass/screen.scss */
.stage-liste li.stage h3 .auteur {
font-size: 0.8em;
}
/* line 218, ../../sass/screen.scss */
/* line 236, ../../sass/screen.scss */
.stage-liste li.stage h3 .auteur, .stage-liste li.stage h3 .auteur a {
font-family: "Dosis", sans-serif;
font-weight: normal;
}
/* line 225, ../../sass/screen.scss */
/* line 243, ../../sass/screen.scss */
.stage-liste li .misc-hdr {
margin-bottom: 10px;
}
/* line 229, ../../sass/screen.scss */
/* line 247, ../../sass/screen.scss */
.stage-liste li .misc-hdr .dates > span {
display: table-cell;
vertical-align: middle;
}
/* line 233, ../../sass/screen.scss */
/* line 251, ../../sass/screen.scss */
.stage-liste li .misc-hdr .dates .year {
padding-left: 8px;
}
/* line 239, ../../sass/screen.scss */
/* line 257, ../../sass/screen.scss */
.stage-liste li a.hoverlink {
position: absolute;
display: block;
@ -318,7 +336,7 @@ header h1 {
z-index: 2;
}
/* line 251, ../../sass/screen.scss */
/* line 269, ../../sass/screen.scss */
ul.infos {
margin: 0 -3px;
padding: 0;
@ -327,7 +345,7 @@ ul.infos {
justify-content: space-between;
width: 100;
}
/* line 259, ../../sass/screen.scss */
/* line 277, ../../sass/screen.scss */
ul.infos li {
display: inline-block;
padding: 5px;
@ -339,28 +357,28 @@ ul.infos li {
text-align: center;
background-color: #ddd;
}
/* line 270, ../../sass/screen.scss */
/* line 288, ../../sass/screen.scss */
ul.infos li.thematique {
color: #0d3f6b;
background-color: #86bff1;
}
/* line 274, ../../sass/screen.scss */
/* line 292, ../../sass/screen.scss */
ul.infos li.matiere {
color: #395214;
background-color: #c7e699;
}
/* line 278, ../../sass/screen.scss */
/* line 296, ../../sass/screen.scss */
ul.infos li.lieu {
color: #7c043c;
background-color: #fb84bc;
}
/* line 282, ../../sass/screen.scss */
/* line 300, ../../sass/screen.scss */
ul.infos li.year {
background-color: #950548;
color: #fff;
display: none;
}
/* line 289, ../../sass/screen.scss */
/* line 307, ../../sass/screen.scss */
ul.infos:after {
content: "";
flex: 1000;
@ -643,7 +661,7 @@ article.stage .section-wrapper .toc .toc-active a {
border: 1px solid #ad0654;
}
/* line 307, ../../sass/screen.scss */
/* line 325, ../../sass/screen.scss */
input, textarea, select, div.tinymce, option, optgroup:before {
background: #fff;
font-size: 1em;
@ -653,13 +671,13 @@ input, textarea, select, div.tinymce, option, optgroup:before {
padding: 5px;
text-align: left;
}
/* line 316, ../../sass/screen.scss */
/* line 334, ../../sass/screen.scss */
input:focus, input.mce-edit-focus, textarea:focus, textarea.mce-edit-focus, select:focus, select.mce-edit-focus, div.tinymce:focus, div.tinymce.mce-edit-focus, option:focus, option.mce-edit-focus, optgroup:before:focus, optgroup:before.mce-edit-focus {
background-color: #e9f5d6;
outline: none;
}
/* line 323, ../../sass/screen.scss */
/* line 341, ../../sass/screen.scss */
input[type='text'], input[type='password'],
input[type='email'], input[type='number'], textarea, select {
border: none;
@ -669,7 +687,7 @@ input[type='email'], input[type='number'], textarea, select {
transition: border 1s ease-out, background 1s ease-out;
}
/* line 332, ../../sass/screen.scss */
/* line 350, ../../sass/screen.scss */
select {
-moz-appearance: none;
appearance: none;
@ -683,21 +701,21 @@ select {
background-color: #fff;
background-size: contain;
}
/* line 345, ../../sass/screen.scss */
/* line 363, ../../sass/screen.scss */
select option {
padding: 3px;
white-space: pre-wrap;
}
/* line 351, ../../sass/screen.scss */
/* line 369, ../../sass/screen.scss */
select optgroup option {
padding-left: 10px;
}
/* line 354, ../../sass/screen.scss */
/* line 372, ../../sass/screen.scss */
select optgroup:before {
font-weight: bold;
}
/* line 360, ../../sass/screen.scss */
/* line 378, ../../sass/screen.scss */
input[type="submit"], .btn {
font: 19px "Dosis", sans-serif;
background-color: #8fcc33;
@ -708,17 +726,17 @@ input[type="submit"], .btn {
display: inline-block;
}
/* line 370, ../../sass/screen.scss */
/* line 388, ../../sass/screen.scss */
p.submits {
text-align: right;
}
/* line 374, ../../sass/screen.scss */
/* line 392, ../../sass/screen.scss */
form .commentaire {
font-style: italic;
}
/* line 378, ../../sass/screen.scss */
/* line 396, ../../sass/screen.scss */
.edit-btn {
border-color: #706c00;
color: #000;
@ -727,14 +745,14 @@ form .commentaire {
background-origin: content-box;
background-size: contain;
}
/* line 386, ../../sass/screen.scss */
/* line 404, ../../sass/screen.scss */
.edit-btn:after {
content: "";
width: 30px;
display: inline-block;
}
/* line 393, ../../sass/screen.scss */
/* line 411, ../../sass/screen.scss */
textarea, div.tinymce {
font-family: "Lato", sans-serif;
border: none;
@ -744,20 +762,20 @@ textarea, div.tinymce {
transition: border 1s ease-out, background 1s ease-out;
}
/* line 402, ../../sass/screen.scss */
/* line 420, ../../sass/screen.scss */
textarea {
height: 200px;
resize: vertical;
}
/* line 410, ../../sass/screen.scss */
/* line 428, ../../sass/screen.scss */
form .field {
margin: 5px 0;
display: flex;
background: #fff;
padding: 10px;
}
/* line 416, ../../sass/screen.scss */
/* line 434, ../../sass/screen.scss */
form .field label, form .field .label {
display: inline-block;
width: 250px;
@ -766,39 +784,39 @@ form .field label, form .field .label {
padding-top: 5px;
flex-shrink: 0;
}
/* line 424, ../../sass/screen.scss */
/* line 442, ../../sass/screen.scss */
form .field label.required:before, form .field .label.required:before {
margin-right: 5px;
content: "*";
color: #f70978;
}
/* line 430, ../../sass/screen.scss */
/* line 448, ../../sass/screen.scss */
form .field label {
font-family: Alegreya, serif;
font-weight: bold;
}
/* line 434, ../../sass/screen.scss */
/* line 452, ../../sass/screen.scss */
form .field .help_text {
font-style: italic;
font-size: 0.9em;
}
/* line 438, ../../sass/screen.scss */
/* line 456, ../../sass/screen.scss */
form .field .input {
display: inline-block;
flex-grow: 1;
margin-right: 10px;
}
/* line 448, ../../sass/screen.scss */
/* line 466, ../../sass/screen.scss */
ul.as-selections {
display: flex;
flex-wrap: wrap;
}
/* line 452, ../../sass/screen.scss */
/* line 470, ../../sass/screen.scss */
ul.as-selections li {
display: inline-block;
}
/* line 456, ../../sass/screen.scss */
/* line 474, ../../sass/screen.scss */
ul.as-selections .as-selection-item {
padding: 0 5px;
background: #f99b20;
@ -807,52 +825,52 @@ ul.as-selections .as-selection-item {
border-radius: 2px;
font-weight: 500;
}
/* line 464, ../../sass/screen.scss */
/* line 482, ../../sass/screen.scss */
ul.as-selections .as-selection-item a.as-close {
color: #fff;
-webkit-cursor: pointer;
cursor: pointer;
margin-right: 5px;
}
/* line 471, ../../sass/screen.scss */
/* line 489, ../../sass/screen.scss */
ul.as-selections .as-selection-item.selected {
background: #8fcc33;
}
/* line 476, ../../sass/screen.scss */
/* line 494, ../../sass/screen.scss */
ul.as-selections .as-original {
flex-grow: 1;
min-width: 200px;
}
/* line 480, ../../sass/screen.scss */
/* line 498, ../../sass/screen.scss */
ul.as-selections .as-original input {
width: 100%;
}
/* line 486, ../../sass/screen.scss */
/* line 504, ../../sass/screen.scss */
div.as-results {
position: relative;
}
/* line 488, ../../sass/screen.scss */
/* line 506, ../../sass/screen.scss */
div.as-results ul {
position: absolute;
width: 100%;
background: #fff;
border: 1px solid #d2ebad;
}
/* line 495, ../../sass/screen.scss */
/* line 513, ../../sass/screen.scss */
div.as-results ul li {
padding: 3px 5px;
}
/* line 501, ../../sass/screen.scss */
/* line 519, ../../sass/screen.scss */
div.as-results ul li.as-result-item.active {
background: #fddeb5;
}
/* line 506, ../../sass/screen.scss */
/* line 524, ../../sass/screen.scss */
div.as-results ul li.as-message {
font-style: italic;
}
/* line 516, ../../sass/screen.scss */
/* line 534, ../../sass/screen.scss */
.window {
display: none;
position: fixed;
@ -863,11 +881,11 @@ div.as-results ul li.as-message {
left: 0;
z-index: 50;
}
/* line 526, ../../sass/screen.scss */
/* line 544, ../../sass/screen.scss */
.window.visible {
display: block;
}
/* line 530, ../../sass/screen.scss */
/* line 548, ../../sass/screen.scss */
.window .window-bg {
background: #000;
opacity: 0.7;
@ -878,7 +896,7 @@ div.as-results ul li.as-message {
top: 0;
z-index: -1;
}
/* line 541, ../../sass/screen.scss */
/* line 559, ../../sass/screen.scss */
.window .window-content {
position: relative;
margin: 0 auto;
@ -892,11 +910,11 @@ div.as-results ul li.as-message {
max-height: 100%;
overflow: auto;
}
/* line 555, ../../sass/screen.scss */
/* line 573, ../../sass/screen.scss */
.window .window-content form label, .window .window-content form .label {
width: 150px;
}
/* line 561, ../../sass/screen.scss */
/* line 579, ../../sass/screen.scss */
.window .window-closer {
position: absolute;
top: 0;
@ -904,65 +922,65 @@ div.as-results ul li.as-message {
padding: 12px;
z-index: 3;
}
/* line 567, ../../sass/screen.scss */
/* line 585, ../../sass/screen.scss */
.window .window-closer:after {
content: "×";
}
/* line 578, ../../sass/screen.scss */
/* line 596, ../../sass/screen.scss */
#lieu_widget .lieu-ui {
position: relative;
}
/* line 580, ../../sass/screen.scss */
/* line 598, ../../sass/screen.scss */
#lieu_widget .lieu-ui .map {
height: 400px;
width: 100%;
}
/* line 584, ../../sass/screen.scss */
/* line 602, ../../sass/screen.scss */
#lieu_widget .lieu-ui.hidden {
display: none;
}
/* line 587, ../../sass/screen.scss */
/* line 605, ../../sass/screen.scss */
#lieu_widget .lieu-ui .masked {
visibility: hidden;
}
/* line 592, ../../sass/screen.scss */
/* line 610, ../../sass/screen.scss */
#lieu_widget .lieu-choixmodif {
display: none;
}
/* line 597, ../../sass/screen.scss */
/* line 615, ../../sass/screen.scss */
#lieu_widget.modif .lieu-choixmodif {
display: unset;
}
/* line 602, ../../sass/screen.scss */
/* line 620, ../../sass/screen.scss */
#lieu_widget.modif .lieu-ui, #lieu_widget.attente .lieu-ui {
display: none;
}
/* line 609, ../../sass/screen.scss */
/* line 627, ../../sass/screen.scss */
#lieu_widget.edit .lieu-ui .lieu-acinput {
display: none;
}
/* line 612, ../../sass/screen.scss */
/* line 630, ../../sass/screen.scss */
#lieu_widget.edit .lieu-ui .map {
height: 200px;
}
/* line 618, ../../sass/screen.scss */
/* line 636, ../../sass/screen.scss */
#lieu_widget #avis_lieu_vide {
display: none;
}
/* line 622, ../../sass/screen.scss */
/* line 640, ../../sass/screen.scss */
#lieu_widget .message {
background: #fddeb5;
padding: 5px;
font-style: italic;
font-size: 0.9em;
}
/* line 628, ../../sass/screen.scss */
/* line 646, ../../sass/screen.scss */
#lieu_widget .message.hidden {
display: none;
}
/* line 634, ../../sass/screen.scss */
/* line 652, ../../sass/screen.scss */
a.lieu-change {
color: #fff;
background: #f99b20;
@ -975,25 +993,25 @@ a.lieu-change {
border-radius: 5px;
margin-right: 7px;
}
/* line 646, ../../sass/screen.scss */
/* line 664, ../../sass/screen.scss */
a.lieu-change.ajout:before {
content: "+";
margin-right: 5px;
}
/* line 652, ../../sass/screen.scss */
/* line 670, ../../sass/screen.scss */
#stages-map {
width: 100%;
height: 600px;
max-height: 90vh;
}
/* line 659, ../../sass/screen.scss */
/* line 677, ../../sass/screen.scss */
#id_stage-thematiques {
display: none;
}
/* line 665, ../../sass/screen.scss */
/* line 683, ../../sass/screen.scss */
.homeh1 {
display: flex;
justify-content: space-between;
@ -1003,26 +1021,26 @@ a.lieu-change.ajout:before {
border-bottom: 3px solid #000;
margin-bottom: 15px;
}
/* line 674, ../../sass/screen.scss */
/* line 692, ../../sass/screen.scss */
.homeh1 h1 {
margin-bottom: 3px;
}
/* line 678, ../../sass/screen.scss */
/* line 696, ../../sass/screen.scss */
.homeh1 > * {
display: inline-block;
}
/* line 681, ../../sass/screen.scss */
/* line 699, ../../sass/screen.scss */
.homeh1 p {
text-align: right;
}
/* line 686, ../../sass/screen.scss */
/* line 704, ../../sass/screen.scss */
.betacadre {
background: #fa6cae;
padding: 10px;
}
/* line 691, ../../sass/screen.scss */
/* line 709, ../../sass/screen.scss */
.entrer {
background: #fff;
max-width: 500px;
@ -1031,84 +1049,84 @@ a.lieu-change.ajout:before {
margin: 15px auto;
}
/* line 699, ../../sass/screen.scss */
/* line 717, ../../sass/screen.scss */
article.promo {
display: block;
font-size: 1.1em;
}
/* line 703, ../../sass/screen.scss */
/* line 721, ../../sass/screen.scss */
article.promo .explications {
display: table;
}
/* line 706, ../../sass/screen.scss */
/* line 724, ../../sass/screen.scss */
article.promo .explications:first-child {
direction: rtl;
}
/* line 708, ../../sass/screen.scss */
/* line 726, ../../sass/screen.scss */
article.promo .explications:first-child > * {
direction: ltr;
}
/* line 713, ../../sass/screen.scss */
/* line 731, ../../sass/screen.scss */
article.promo .explications > div {
display: table-cell;
vertical-align: middle;
text-align: center;
}
/* line 718, ../../sass/screen.scss */
/* line 736, ../../sass/screen.scss */
article.promo .explications > div p {
margin: 15px 15px;
}
/* line 726, ../../sass/screen.scss */
/* line 744, ../../sass/screen.scss */
.faq-toc {
font-family: "Lato", sans-serif;
display: block;
max-width: 700px;
margin: 0 auto;
}
/* line 731, ../../sass/screen.scss */
/* line 749, ../../sass/screen.scss */
.faq-toc ul {
margin: 20px;
}
/* line 735, ../../sass/screen.scss */
/* line 753, ../../sass/screen.scss */
.faq-toc ul li a {
color: #000;
display: block;
padding: 5px;
}
/* line 741, ../../sass/screen.scss */
/* line 759, ../../sass/screen.scss */
.faq-toc ul li.toc-h1 {
display: none;
}
/* line 745, ../../sass/screen.scss */
/* line 763, ../../sass/screen.scss */
.faq-toc ul li.toc-h2 a {
background: #fcc883;
}
/* line 749, ../../sass/screen.scss */
/* line 767, ../../sass/screen.scss */
.faq-toc ul li.toc-h3 a {
padding-left: 10px;
background: #fff;
font-weight: normal;
}
/* line 755, ../../sass/screen.scss */
/* line 773, ../../sass/screen.scss */
.faq-toc ul li a:hover {
color: #395214;
background: #bce085 !important;
}
/* line 764, ../../sass/screen.scss */
/* line 782, ../../sass/screen.scss */
.faq article {
background: #fff;
padding: 15px;
}
/* line 767, ../../sass/screen.scss */
/* line 785, ../../sass/screen.scss */
.faq article h2 {
background-color: #fcc883;
color: #ae6505;
margin: -15px;
padding: 15px;
}
/* line 774, ../../sass/screen.scss */
/* line 792, ../../sass/screen.scss */
.faq article h3 {
color: #0f4c82;
background-color: #9dcbf3;
@ -1116,19 +1134,19 @@ article.promo .explications > div p {
margin-top: 30px;
padding: 10px 15px;
}
/* line 781, ../../sass/screen.scss */
/* line 799, ../../sass/screen.scss */
.faq article h3:nth-child(2) {
margin-top: 0;
}
/* line 786, ../../sass/screen.scss */
/* line 804, ../../sass/screen.scss */
.faq article ul {
padding-left: 20px;
}
/* line 788, ../../sass/screen.scss */
/* line 806, ../../sass/screen.scss */
.faq article ul li {
list-style: initial;
}
/* line 793, ../../sass/screen.scss */
/* line 811, ../../sass/screen.scss */
.faq article p, .faq article ul {
font-family: "Lato", sans-serif;
font-size: 18px;
@ -1376,22 +1394,27 @@ section.content.recherche.vue-hybride.vue-details .recherche-liste.recherche-det
section.content.recherche .recherche-liste .dates .detail {
display: none;
}
/* line 243, ../../sass/_recherche.scss */
ul.messages {
display: none;
}
}
@media screen and (max-width: 500px), screen and (max-width: 800px) and (orientation: portrait) {
/* line 247, ../../sass/_recherche.scss */
/* line 251, ../../sass/_recherche.scss */
section.content.recherche form.recherche .generale span input {
font-size: 0.9em;
flex: 1;
}
/* line 251, ../../sass/_recherche.scss */
/* line 255, ../../sass/_recherche.scss */
section.content.recherche form.recherche .generale span input[type=submit] {
white-space: normal;
}
/* line 255, ../../sass/_recherche.scss */
/* line 259, ../../sass/_recherche.scss */
section.content.recherche.vue-hybride, section.content.recherche.vue-carte {
flex-direction: column;
}
/* line 256, ../../sass/_recherche.scss */
/* line 260, ../../sass/_recherche.scss */
section.content.recherche.vue-hybride .recherche-liste, section.content.recherche.vue-carte .recherche-liste {
max-width: 100vw;
min-width: unset;

View file

@ -31,7 +31,7 @@
{% endif %}
<li><a href="{% url 'avisstage:faq' %}">FAQ</a></li>
{% if user.is_staff %}
<li><a href="{% url 'admin:index' %}">Admin</a></li>
<li><a href="{% url 'avisstage:moderation' %}">Modo</a></li>
{% endif %}
{% if user.is_authenticated %}
<li><a href="{% url 'logout' %}"><span class="username">{{ user.username }}</span><br/> Déconnexion</a></li>

View file

@ -0,0 +1,28 @@
{% extends "avisstage/base.html" %}
{% load staticfiles %}
{% block title %}Statistiques - ExperiENS{% endblock %}
{% block content %}
<h1>Statistiques</h1>
{% if user.is_superuser %}
<p><a href="{% url "admin:index" %}">Administration de django</a></p>
{% endif %}
<article>
<h2>Stages</h2>
<p>{{ num_stages }} stages créés, {{ num_stages_pub }} stages publiés</p>
<p>{% for npm in num_par_matiere %}
{{ npm.scount }} en {{ npm.matieres__nom }},
{% endfor %}
</p>
<h2>Utilisateurs</h2>
<p>{{ num_users }} utilisateurs connectés au moins une fois, {{ num_auteurs }} ont écrit une fiche</p>
<p>{% for nsta, naut in num_par_auteur %}
{{ naut }} en {{ naut|pluralize:"a,ont" }} écrit {{ nsta }},
{% endfor %}
</p>
<h2>Lieux</h2>
<p>{{ num_lieux_utiles }} lieux ont un stage associé</p>
</article>
{% endblock %}

View file

@ -24,5 +24,6 @@ urlpatterns = [
url(r'^recherche/$', views.recherche, name='recherche'),
url(r'^recherche/resultats/$', views.recherche_resultats, name='recherche_resultats'),
url(r'^feedback/$', views.feedback, name='feedback'),
url(r'^moderation/$', views.statistiques, name='moderation'),
url(r'^api/', include(v1_api.urls)),
]

View file

@ -6,11 +6,13 @@ from django.views.generic import DetailView, ListView
from django.views.generic.edit import UpdateView, CreateView
from django import forms
from django.urls import reverse
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from braces.views import LoginRequiredMixin
from django.http import JsonResponse, HttpResponseForbidden
from django.core.mail import send_mail
from django.db.models import Q
from django.db.models import Q, Count
from collections import Counter
from avisstage.models import Normalien, Stage, Lieu, AvisLieu, AvisStage
from avisstage.forms import StageForm, LieuForm, AvisStageForm, AvisLieuForm, FeedbackForm
@ -258,3 +260,27 @@ def feedback(request):
else:
form = FeedbackForm()
return render(request, 'avisstage/formulaire/feedback.html', {"form": form})
#
# STATISTIQUES
#
@login_required
@staff_member_required
def statistiques(request):
nstages = Stage.objects.count()
npubstages = Stage.objects.filter(public=True).count()
nbymatiere = Stage.objects.values('matieres__nom').annotate(scount=Count('matieres__nom'))
nusers = Normalien.objects.count()
nauts = Normalien.objects.filter(stages__isnull=False).distinct().count()
nbyaut = Counter(Normalien.objects.filter(stages__isnull=False).annotate(scount=Count('stages')).values_list('scount', flat="True")).items()
nlieux = Lieu.objects.filter(stages__isnull=False).distinct().count()
return render(request, 'avisstage/moderation/statistiques.html',
{'num_stages': nstages,
'num_stages_pub': npubstages,
'num_par_matiere': nbymatiere,
'num_users': nusers,
'num_auteurs': nauts,
'num_par_auteur': nbyaut,
'num_lieux_utiles': nlieux})