diff --git a/avisstage/models.py b/avisstage/models.py index 344a6e9..b7990e2 100644 --- a/avisstage/models.py +++ b/avisstage/models.py @@ -71,7 +71,7 @@ def create_user_profile(sender, instance, created, **kwargs): profil.promotion = u'%s %s' % (dep, annee) pmail = infos.get('mailRoutingAddress', ['%s@clipper.ens.fr'%instance.username]) - if len(pmail) > 1: + if len(pmail) > 0: profil.mail = pmail[0] profil.save() except ldap.LDAPError: diff --git a/avisstage/sass/screen.scss b/avisstage/sass/screen.scss index a7d6eda..16d3049 100644 --- a/avisstage/sass/screen.scss +++ b/avisstage/sass/screen.scss @@ -172,6 +172,33 @@ p { // Les stages + +ul.infos { + margin: 0 -3px; + + li { + display: inline-block; + padding: 5px; + margin: 3px; + font-weight: normal; + font-size: 0.9em; + border-radius: 4px; + + &.thematique { + background-color: $vert; + color: #fff; + } + &.matiere { + color: #fff; + background-color: $fond; + } + &.lieu { + color: #fff; + background-color: $compl; + } + } +} + article.stage { font-weight: normal; @@ -214,26 +241,6 @@ article.stage { &.misc { padding-top: 0; - ul.infos { - margin: 0 -3px; - - li { - display: inline-block; - padding: 5px; - margin: 3px; - font-weight: normal; - color: #fff; - font-size: 0.9em; - border-radius: 4px; - - &.thematique { - background-color: $compl; - } - &.matiere { - background-color: $fond; - } - } - } } .chapo, .avis-texte { @@ -370,18 +377,20 @@ input, textarea, select, div.tinymce { line-height: 1.3em; font-weight: 500; padding: 5px; + + &:focus, &.mce-edit-focus { + background-color: lighten($fond, 40%); + outline: none; + } } -input[type='text'], input[type='password'], input[type='email'], textarea, select { +input[type='text'], input[type='password'], +input[type='email'], textarea, select { border:none; border-bottom: 1px solid $fond; width: 100%; max-width: 100%; transition: border 1s ease-out, background 1s ease-out; - - &:focus { - background-color: lighten($fond, 50%); - } } input[type="submit"], @@ -403,6 +412,20 @@ h1 .btn { display:inline-block; } +.edit-btn { + border-color:darken($jaune, 30%); + color: #000; + background: url($staticurl + "images/edit.svg") no-repeat right center; + background-color:lighten($jaune, 10%); + background-origin: content-box; + background-size: contain; + + &:after { + content:""; + width: 30px; + display: inline-block; + } +} select { -moz-appearance: none; @@ -420,11 +443,6 @@ textarea, div.tinymce { transition: border 1s ease-out, background 1s ease-out; } -div.tinymce.mce-edit-focus { - background-color: lighten($fond, 50%); - outline: none; -} - textarea { height: 200px; resize: vertical; @@ -527,9 +545,6 @@ div.as-results { } // -#map_addlieu { - height: 500px; -} .window { display:none; @@ -568,7 +583,12 @@ div.as-results { width: 90%; max-height: 100%; overflow: auto; - + + form { + label, .label { + width: 150px; + } + } } .window-closer { @@ -583,6 +603,10 @@ div.as-results { } } +#map_addlieu { + height: 500px; +} + .lieu-ui { .map { height: 400px; @@ -673,17 +697,31 @@ article.promo { display: none; } -.edit-btn { - border-color:darken($jaune, 30%); - color: #000; - background: url($staticurl + "images/edit.svg") no-repeat right center; - background-color:lighten($jaune, 10%); - background-origin: content-box; - background-size: contain; - - &:after { - content:""; - width: 30px; - display: inline-block; +.stage-liste { + li { + display: block; + &.date-maj { + font-weight: bold; + font-size: 0.9em; + padding: 3px 0; + } + &.stage { + padding: 10px; + background: #fff; + margin: 10px; + + h3 { + font-size: 1.4em; + + .auteur { + font-family: $textfont; + font-weight: bold; + font-size: 0.8em; + } + } + ul.infos { + display:inline; + } + } } } diff --git a/avisstage/static/css/screen.css b/avisstage/static/css/screen.css index 368f09b..9f298c0 100644 --- a/avisstage/static/css/screen.css +++ b/avisstage/static/css/screen.css @@ -225,11 +225,40 @@ header h1 { color: #000; } -/* line 175, ../../sass/screen.scss */ +/* line 176, ../../sass/screen.scss */ +ul.infos { + margin: 0 -3px; +} +/* line 179, ../../sass/screen.scss */ +ul.infos li { + display: inline-block; + padding: 5px; + margin: 3px; + font-weight: normal; + font-size: 0.9em; + border-radius: 4px; +} +/* line 187, ../../sass/screen.scss */ +ul.infos li.thematique { + background-color: #1a82dd; + color: #fff; +} +/* line 191, ../../sass/screen.scss */ +ul.infos li.matiere { + color: #fff; + background-color: #8fcc33; +} +/* line 195, ../../sass/screen.scss */ +ul.infos li.lieu { + color: #fff; + background-color: #f99b20; +} + +/* line 202, ../../sass/screen.scss */ article.stage { font-weight: normal; } -/* line 178, ../../sass/screen.scss */ +/* line 205, ../../sass/screen.scss */ article.stage h2 { background: #ddda78; color: #fff; @@ -238,7 +267,7 @@ article.stage h2 { margin-bottom: 25px; text-shadow: -3px 3px 0 rgba(0, 0, 0, 0.3); } -/* line 186, ../../sass/screen.scss */ +/* line 213, ../../sass/screen.scss */ article.stage h3 { border-bottom: 2px solid #cb954e; margin-left: -25px; @@ -248,80 +277,58 @@ article.stage h3 { color: #000; text-shadow: -3px 3px 0 rgba(0, 0, 0, 0.1); } -/* line 197, ../../sass/screen.scss */ +/* line 224, ../../sass/screen.scss */ article.stage #stage-map { height: 300px; width: 100%; } -/* line 202, ../../sass/screen.scss */ +/* line 229, ../../sass/screen.scss */ article.stage section { background: #eee; padding: 14px; max-width: 600px; margin: 30px auto; } -/* line 208, ../../sass/screen.scss */ +/* line 235, ../../sass/screen.scss */ article.stage section:first-child { margin-top: 0; } -/* line 210, ../../sass/screen.scss */ +/* line 237, ../../sass/screen.scss */ article.stage section:first-child h3 { margin-top: 0; } -/* line 215, ../../sass/screen.scss */ +/* line 242, ../../sass/screen.scss */ article.stage section.misc { padding-top: 0; } -/* line 217, ../../sass/screen.scss */ -article.stage section.misc ul.infos { - margin: 0 -3px; -} -/* line 220, ../../sass/screen.scss */ -article.stage section.misc ul.infos li { - display: inline-block; - padding: 5px; - margin: 3px; - font-weight: normal; - color: #fff; - font-size: 0.9em; - border-radius: 4px; -} -/* line 229, ../../sass/screen.scss */ -article.stage section.misc ul.infos li.thematique { - background-color: #f99b20; -} -/* line 232, ../../sass/screen.scss */ -article.stage section.misc ul.infos li.matiere { - background-color: #8fcc33; -} -/* line 239, ../../sass/screen.scss */ +/* line 246, ../../sass/screen.scss */ article.stage section .chapo, article.stage section .avis-texte { margin-bottom: 15px; background: #fff; padding: 20px; } -/* line 244, ../../sass/screen.scss */ +/* line 251, ../../sass/screen.scss */ article.stage section .chapo { font-size: 1.1em; font-weight: 500; font-variant: small-caps; } -/* line 249, ../../sass/screen.scss */ +/* line 256, ../../sass/screen.scss */ article.stage section .avis-texte { border-left: 1px solid #ccc; padding-left: 15px; } -/* line 254, ../../sass/screen.scss */ +/* line 261, ../../sass/screen.scss */ article.stage section .plusmoins { max-width: 600px; margin: 15px auto; } -/* line 258, ../../sass/screen.scss */ +/* line 265, ../../sass/screen.scss */ article.stage section .plusmoins > div { display: table; width: 100%; } -/* line 262, ../../sass/screen.scss */ +/* line 269, ../../sass/screen.scss */ article.stage section .plusmoins > div:before { content: " "; width: 100px; @@ -330,101 +337,101 @@ article.stage section .plusmoins > div:before { text-align: right; padding-right: 12px; } -/* line 271, ../../sass/screen.scss */ +/* line 278, ../../sass/screen.scss */ article.stage section .plusmoins > div > *, article.stage section .plusmoins > div:before { display: table-cell; } -/* line 275, ../../sass/screen.scss */ +/* line 282, ../../sass/screen.scss */ article.stage section .plusmoins > div > div { padding: 15px; color: #fff; } -/* line 278, ../../sass/screen.scss */ +/* line 285, ../../sass/screen.scss */ article.stage section .plusmoins > div > div h4 { font-weight: normal; margin-left: -5px; font-size: 0.9em; opacity: 0.9; } -/* line 284, ../../sass/screen.scss */ +/* line 291, ../../sass/screen.scss */ article.stage section .plusmoins > div > div p { font-weight: bold; margin: 2px; } -/* line 292, ../../sass/screen.scss */ +/* line 299, ../../sass/screen.scss */ article.stage section .plusmoins .plus > div { background: #1775c6; } -/* line 295, ../../sass/screen.scss */ +/* line 302, ../../sass/screen.scss */ article.stage section .plusmoins .plus:before { content: "Les +"; vertical-align: bottom; color: #1567af; } -/* line 302, ../../sass/screen.scss */ +/* line 309, ../../sass/screen.scss */ article.stage section .plusmoins .moins > div { background: #df076c; } -/* line 305, ../../sass/screen.scss */ +/* line 312, ../../sass/screen.scss */ article.stage section .plusmoins .moins:before { content: "Les -"; vertical-align: top; color: #c70660; } -/* line 315, ../../sass/screen.scss */ +/* line 322, ../../sass/screen.scss */ .edit-box { background: #eee; margin: 10px; padding: 10px 20px; text-align: center; } -/* line 321, ../../sass/screen.scss */ +/* line 328, ../../sass/screen.scss */ .edit-box.public { background: #cae3f9; border: 1px solid #125b9b; } -/* line 326, ../../sass/screen.scss */ +/* line 333, ../../sass/screen.scss */ .edit-box.prive { background: #fdcfe4; border: 1px solid #ad0654; } -/* line 333, ../../sass/screen.scss */ +/* line 340, ../../sass/screen.scss */ .article-wrapper { display: table; } -/* line 335, ../../sass/screen.scss */ +/* line 342, ../../sass/screen.scss */ .article-wrapper .toc-wrapper, .article-wrapper article { display: table-cell; vertical-align: top; } -/* line 339, ../../sass/screen.scss */ +/* line 346, ../../sass/screen.scss */ .article-wrapper .toc-wrapper { max-width: 250px; width: 25%; } -/* line 343, ../../sass/screen.scss */ +/* line 350, ../../sass/screen.scss */ .article-wrapper .toc { position: -webkit-sticky; position: sticky; top: 0; } -/* line 347, ../../sass/screen.scss */ +/* line 354, ../../sass/screen.scss */ .article-wrapper .toc a { color: inherit; font-weight: normal; } -/* line 354, ../../sass/screen.scss */ +/* line 361, ../../sass/screen.scss */ .article-wrapper .toc .toc-h3 a { font-weight: 300; } -/* line 357, ../../sass/screen.scss */ +/* line 364, ../../sass/screen.scss */ .article-wrapper .toc .toc-active a { color: #8fcc33; } -/* line 366, ../../sass/screen.scss */ +/* line 373, ../../sass/screen.scss */ input, textarea, select, div.tinymce { background: #fff; font-size: 1em; @@ -433,21 +440,23 @@ input, textarea, select, div.tinymce { font-weight: 500; padding: 5px; } +/* line 381, ../../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 { + background-color: #e9f5d6; + outline: none; +} -/* line 375, ../../sass/screen.scss */ -input[type='text'], input[type='password'], input[type='email'], textarea, select { +/* line 387, ../../sass/screen.scss */ +input[type='text'], input[type='password'], +input[type='email'], textarea, select { border: none; border-bottom: 1px solid #8fcc33; width: 100%; max-width: 100%; transition: border 1s ease-out, background 1s ease-out; } -/* line 382, ../../sass/screen.scss */ -input[type='text']:focus, input[type='password']:focus, input[type='email']:focus, textarea:focus, select:focus { - background-color: white; -} -/* line 387, ../../sass/screen.scss */ +/* line 396, ../../sass/screen.scss */ input[type="submit"], .btn { font: 19px "Dosis", sans-serif; @@ -461,14 +470,30 @@ input[type="submit"], margin-right: 0; } -/* line 400, ../../sass/screen.scss */ +/* line 409, ../../sass/screen.scss */ p input[type="submit"], p .btn, h1 .btn { display: inline-block; } -/* line 407, ../../sass/screen.scss */ +/* line 415, ../../sass/screen.scss */ +.edit-btn { + border-color: #706c00; + color: #000; + background: url("/experiens/static/images/edit.svg") no-repeat right center; + background-color: #fff83d; + background-origin: content-box; + background-size: contain; +} +/* line 423, ../../sass/screen.scss */ +.edit-btn:after { + content: ""; + width: 30px; + display: inline-block; +} + +/* line 430, ../../sass/screen.scss */ select { -moz-appearance: none; appearance: none; @@ -477,7 +502,7 @@ select { cursor: pointer; } -/* line 415, ../../sass/screen.scss */ +/* line 438, ../../sass/screen.scss */ textarea, div.tinymce { border: none; border-left: 1px solid #8fcc33; @@ -486,26 +511,20 @@ textarea, div.tinymce { transition: border 1s ease-out, background 1s ease-out; } -/* line 423, ../../sass/screen.scss */ -div.tinymce.mce-edit-focus { - background-color: white; - outline: none; -} - -/* line 428, ../../sass/screen.scss */ +/* line 446, ../../sass/screen.scss */ textarea { height: 200px; resize: vertical; } -/* line 434, ../../sass/screen.scss */ +/* line 452, ../../sass/screen.scss */ form .field { margin: 5px 0; display: flex; background: #fff; padding: 10px; } -/* line 440, ../../sass/screen.scss */ +/* line 458, ../../sass/screen.scss */ form .field label, form .field .label { display: inline-block; width: 250px; @@ -514,33 +533,33 @@ form .field label, form .field .label { padding-top: 5px; flex-shrink: 0; } -/* line 448, ../../sass/screen.scss */ +/* line 466, ../../sass/screen.scss */ form .field label { font-family: Podkova, serif; font-weight: bold; } -/* line 452, ../../sass/screen.scss */ +/* line 470, ../../sass/screen.scss */ form .field .help_text { font-style: italic; font-size: 0.9em; } -/* line 456, ../../sass/screen.scss */ +/* line 474, ../../sass/screen.scss */ form .field .input { display: inline-block; flex-grow: 1; margin-right: 10px; } -/* line 465, ../../sass/screen.scss */ +/* line 483, ../../sass/screen.scss */ ul.as-selections { display: flex; flex-wrap: wrap; } -/* line 469, ../../sass/screen.scss */ +/* line 487, ../../sass/screen.scss */ ul.as-selections li { display: inline-block; } -/* line 473, ../../sass/screen.scss */ +/* line 491, ../../sass/screen.scss */ ul.as-selections .as-selection-item { padding: 0 5px; background: #f99b20; @@ -549,57 +568,52 @@ ul.as-selections .as-selection-item { border-radius: 2px; font-weight: 500; } -/* line 481, ../../sass/screen.scss */ +/* line 499, ../../sass/screen.scss */ ul.as-selections .as-selection-item a.as-close { color: #fff; -webkit-cursor: pointer; cursor: pointer; margin-right: 5px; } -/* line 488, ../../sass/screen.scss */ +/* line 506, ../../sass/screen.scss */ ul.as-selections .as-selection-item.selected { background: #8fcc33; } -/* line 493, ../../sass/screen.scss */ +/* line 511, ../../sass/screen.scss */ ul.as-selections .as-original { flex-grow: 1; min-width: 200px; } -/* line 497, ../../sass/screen.scss */ +/* line 515, ../../sass/screen.scss */ ul.as-selections .as-original input { width: 100%; } -/* line 503, ../../sass/screen.scss */ +/* line 521, ../../sass/screen.scss */ div.as-results { position: relative; } -/* line 505, ../../sass/screen.scss */ +/* line 523, ../../sass/screen.scss */ div.as-results ul { position: absolute; width: 100%; background: #fff; border: 1px solid #d2ebad; } -/* line 512, ../../sass/screen.scss */ +/* line 530, ../../sass/screen.scss */ div.as-results ul li { padding: 3px 5px; } -/* line 518, ../../sass/screen.scss */ +/* line 536, ../../sass/screen.scss */ div.as-results ul li.as-result-item.active { background: white; } -/* line 523, ../../sass/screen.scss */ +/* line 541, ../../sass/screen.scss */ div.as-results ul li.as-message { font-style: italic; } -/* line 530, ../../sass/screen.scss */ -#map_addlieu { - height: 500px; -} - -/* line 534, ../../sass/screen.scss */ +/* line 549, ../../sass/screen.scss */ .window { display: none; position: fixed; @@ -610,11 +624,11 @@ div.as-results ul li.as-message { left: 0; z-index: 10; } -/* line 544, ../../sass/screen.scss */ +/* line 559, ../../sass/screen.scss */ .window.visible { display: block; } -/* line 548, ../../sass/screen.scss */ +/* line 563, ../../sass/screen.scss */ .window .window-bg { background: #000; opacity: 0.7; @@ -625,7 +639,7 @@ div.as-results ul li.as-message { top: 0; z-index: -1; } -/* line 559, ../../sass/screen.scss */ +/* line 574, ../../sass/screen.scss */ .window .window-content { position: relative; margin: 0 auto; @@ -639,7 +653,11 @@ div.as-results ul li.as-message { max-height: 100%; overflow: auto; } -/* line 574, ../../sass/screen.scss */ +/* line 588, ../../sass/screen.scss */ +.window .window-content form label, .window .window-content form .label { + width: 150px; +} +/* line 594, ../../sass/screen.scss */ .window .window-closer { position: absolute; top: 0; @@ -647,31 +665,36 @@ div.as-results ul li.as-message { padding: 12px; z-index: 3; } -/* line 580, ../../sass/screen.scss */ +/* line 600, ../../sass/screen.scss */ .window .window-closer:after { content: "×"; } -/* line 587, ../../sass/screen.scss */ +/* line 606, ../../sass/screen.scss */ +#map_addlieu { + height: 500px; +} + +/* line 611, ../../sass/screen.scss */ .lieu-ui .map { height: 400px; width: 100%; } -/* line 591, ../../sass/screen.scss */ +/* line 615, ../../sass/screen.scss */ .lieu-ui .hidden { display: none; } -/* line 594, ../../sass/screen.scss */ +/* line 618, ../../sass/screen.scss */ .lieu-ui .masked { visibility: hidden; } -/* line 599, ../../sass/screen.scss */ +/* line 623, ../../sass/screen.scss */ #avis_lieu_vide { display: none; } -/* line 603, ../../sass/screen.scss */ +/* line 627, ../../sass/screen.scss */ a.lieu-change { color: #fff; background: #f99b20; @@ -684,19 +707,19 @@ a.lieu-change { border-radius: 5px; margin-right: 7px; } -/* line 615, ../../sass/screen.scss */ +/* line 639, ../../sass/screen.scss */ a.lieu-change.ajout:before { content: "+"; margin-right: 5px; } -/* line 621, ../../sass/screen.scss */ +/* line 645, ../../sass/screen.scss */ #stages-map { width: 100%; height: 600px; } -/* line 626, ../../sass/screen.scss */ +/* line 650, ../../sass/screen.scss */ #feedback-button { position: fixed; left: 0; @@ -709,13 +732,13 @@ a.lieu-change.ajout:before { transform-origin: bottom left; } -/* line 639, ../../sass/screen.scss */ +/* line 663, ../../sass/screen.scss */ .betacadre { background: #fa6cae; padding: 10px; } -/* line 644, ../../sass/screen.scss */ +/* line 668, ../../sass/screen.scss */ .entrer { background: #fff; max-width: 500px; @@ -724,43 +747,58 @@ a.lieu-change.ajout:before { margin: 15px auto; } -/* line 652, ../../sass/screen.scss */ +/* line 676, ../../sass/screen.scss */ article.promo { display: block; font-size: 1.1em; } -/* line 656, ../../sass/screen.scss */ +/* line 680, ../../sass/screen.scss */ article.promo .explications { display: table; } -/* line 660, ../../sass/screen.scss */ +/* line 684, ../../sass/screen.scss */ article.promo .explications > div { display: table-cell; vertical-align: middle; text-align: center; } -/* line 665, ../../sass/screen.scss */ +/* line 689, ../../sass/screen.scss */ article.promo .explications > div p { margin: 15px 15px; } -/* line 672, ../../sass/screen.scss */ +/* line 696, ../../sass/screen.scss */ #id_stage-thematiques { display: none; } -/* line 676, ../../sass/screen.scss */ -.edit-btn { - border-color: #706c00; - color: #000; - background: url("/experiens/static/images/edit.svg") no-repeat right center; - background-color: #fff83d; - background-origin: content-box; - background-size: contain; +/* line 701, ../../sass/screen.scss */ +.stage-liste li { + display: block; } -/* line 684, ../../sass/screen.scss */ -.edit-btn:after { - content: ""; - width: 30px; - display: inline-block; +/* line 703, ../../sass/screen.scss */ +.stage-liste li.date-maj { + font-weight: bold; + font-size: 0.9em; + padding: 3px 0; +} +/* line 708, ../../sass/screen.scss */ +.stage-liste li.stage { + padding: 10px; + background: #fff; + margin: 10px; +} +/* line 713, ../../sass/screen.scss */ +.stage-liste li.stage h3 { + font-size: 1.4em; +} +/* line 716, ../../sass/screen.scss */ +.stage-liste li.stage h3 .auteur { + font-family: "Dosis", sans-serif; + font-weight: bold; + font-size: 0.8em; +} +/* line 722, ../../sass/screen.scss */ +.stage-liste li.stage ul.infos { + display: inline; } diff --git a/avisstage/static/js/select_lieu.js b/avisstage/static/js/select_lieu.js index b462f57..9ce5ef5 100644 --- a/avisstage/static/js/select_lieu.js +++ b/avisstage/static/js/select_lieu.js @@ -182,6 +182,9 @@ function SelectLieuWidget(STATIC_ROOT, API_LIEU, target, callback) { data.marqueur = marqueur; var desc = $("
").append($("

").text(data.nom)) .append($("

").text(data.ville+", "+data.pays_nom)); + if (data.num_stages !== undefined) + desc.append($("

").text(data.num_stages + (data.num_stages > 1 ? " stages" : " stage") + " à cet endroit")); + var activeBtn = $("", {href:"javascript:void(0);"}) .prop("_lieustage_data", data) .on("click", choixLieuStage); diff --git a/avisstage/templates/avisstage/liste/stage.html b/avisstage/templates/avisstage/liste/stage.html new file mode 100644 index 0000000..085f4de --- /dev/null +++ b/avisstage/templates/avisstage/liste/stage.html @@ -0,0 +1,30 @@ +{% extends "avisstage/base.html" %} +{% load staticfiles %} + +{% block title %}Dernières mises à jour - ExperiENS{% endblock %} + +{% block content %} +

Dernières mises à jour

+
+ +
+{% endblock %} diff --git a/avisstage/templates/avisstage/recherche.html b/avisstage/templates/avisstage/recherche.html index 7a7ab0c..53300ce 100644 --- a/avisstage/templates/avisstage/recherche.html +++ b/avisstage/templates/avisstage/recherche.html @@ -81,7 +81,7 @@ {% block content %}

Recherche

- +

Dernières mises à jour

Carte des stages

diff --git a/avisstage/urls.py b/avisstage/urls.py index b479670..b1b70f1 100644 --- a/avisstage/urls.py +++ b/avisstage/urls.py @@ -14,6 +14,7 @@ urlpatterns = [ url(r'^stage/(?P\w+)/$', views.StageView.as_view(), name='stage'), url(r'^stage/(?P\w+)/edit/$', views.manage_stage, name='stage_edit'), url(r'^stage/(?P\w+)/publication/$', views.publier_stage, name='stage_publication'), + url(r'^stages/majs/$', views.StageListe.as_view(), name='stage_majs'), url(r'^lieu/ajout/$', views.LieuAjout.as_view(), name='lieu_ajout'), url(r'^profil/show/(?P\w+)/$', views.ProfilView.as_view(), diff --git a/avisstage/views.py b/avisstage/views.py index 23d83a6..b87a58c 100644 --- a/avisstage/views.py +++ b/avisstage/views.py @@ -2,7 +2,7 @@ from django.shortcuts import render, redirect, get_object_or_404 -from django.views.generic import DetailView +from django.views.generic import DetailView, ListView from django.views.generic.edit import UpdateView, CreateView from django import forms from django.urls import reverse @@ -94,6 +94,14 @@ class StageView(DetailView, LoginRequiredMixin): filtre = Q(auteur__user_id=self.request.user.id) | Q(public=True) return Stage.objects.filter(filtre) +class StageListe(ListView, LoginRequiredMixin): + model = Stage + template_name = 'avisstage/liste/stage.html' + + def get_queryset(self): + return Stage.objects.filter(public=True).order_by('-date_maj') + + # Lieux des stages class LieuAjout(CreateView, LoginRequiredMixin): model = Lieu