This commit is contained in:
Lucie Galland 2021-05-27 14:27:30 +02:00
parent 7b19a581cf
commit ab120e5e63
10 changed files with 226 additions and 388 deletions

View file

@ -29,6 +29,9 @@ urlpatterns += i18n_patterns(
path("change", gestion_views.ChangeMembre.as_view(), name="change_membre"), path("change", gestion_views.ChangeMembre.as_view(), name="change_membre"),
path("password", gestion_views.ChangePassword.as_view(), name="change_password"), path("password", gestion_views.ChangePassword.as_view(), name="change_password"),
path("thanks", gestion_views.Thanks.as_view(), name="thanks"), path("thanks", gestion_views.Thanks.as_view(), name="thanks"),
path("social", gestion_views.Social.as_view(), name="social"),
path("chef", gestion_views.Chef.as_view(), name="chef"),
path("profil", gestion_views.Profil.as_view(), name="profile"),
path("changename", gestion_views.ChangeName.as_view(), name="change-doodle-name"), path("changename", gestion_views.ChangeName.as_view(), name="change-doodle-name"),
path("logout", auth_views.LogoutView.as_view(next_page="home"), name="logout"), path("logout", auth_views.LogoutView.as_view(next_page="home"), name="logout"),
path("login", gestion_views.MyLoginView.as_view(), name="login"), path("login", gestion_views.MyLoginView.as_view(), name="login"),

View file

@ -10,6 +10,10 @@
*/ */
/* Instagram feed*/ /* Instagram feed*/
#app{ #app{
display: grid; display: grid;
grid-gap: var(--spacing); grid-gap: var(--spacing);
@ -1584,9 +1588,7 @@
width: device-width; width: device-width;
} }
body {
-ms-overflow-style: scrollbar;
}
@media screen and (max-width: 480px) { @media screen and (max-width: 480px) {
@ -1600,16 +1602,7 @@
background: #e4522f; background: #e4522f;
} }
body.is-loading *, body.is-loading *:before, body.is-loading *:after {
-moz-animation: none !important;
-webkit-animation: none !important;
-ms-animation: none !important;
animation: none !important;
-moz-transition: none !important;
-webkit-transition: none !important;
-ms-transition: none !important;
transition: none !important;
}
/* Type */ /* Type */
@ -2310,7 +2303,7 @@ div.spoiler
display: block; display: block;
float: left; float: left;
margin-right: -2em; margin-right: -2em;
opacity: 0; height: 1em;
width: 1em; width: 1em;
z-index: -1; z-index: -1;
} }
@ -2730,31 +2723,7 @@ div.spoiler
text-align: center; text-align: center;
} }
header p {
position: relative;
margin: 0 0 1.5em 0;
}
header h2 + p {
font-size: 1.25em;
margin-top: -1em;
}
header h3 + p {
font-size: 1.1em;
margin-top: -0.8em;
}
header h4 + p,
header h5 + p,
header h6 + p {
font-size: 0.9em;
margin-top: -0.6em;
}
header p {
color: #676d71;
}
/* Tab */ /* Tab */
@ -2914,17 +2883,8 @@ div.spoiler
z-index: 99; z-index: 99;
} }
.wrapper header {
margin-bottom: 4em;
}
@media screen and (max-width: 736px) {
.wrapper header {
margin-bottom: 2em;
}
}
.wrapper.style1 { .wrapper.style1 {
background-color: #e39576; background-color: #e39576;
@ -3130,9 +3090,7 @@ div.spoiler
border-top-color: rgba(255, 255, 255, 0.15); border-top-color: rgba(255, 255, 255, 0.15);
} }
.wrapper.style1 header p {
color: #ffffff;
}
.wrapper.style1 table tbody tr { .wrapper.style1 table tbody tr {
border-color: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.15);
@ -3353,9 +3311,7 @@ div.spoiler
border-top-color: rgba(255, 255, 255, 0.15); border-top-color: rgba(255, 255, 255, 0.15);
} }
.wrapper.style2 header p {
color: #9ba2a8;
}
.wrapper.style2 table tbody tr { .wrapper.style2 table tbody tr {
border-color: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.15);
@ -3489,281 +3445,7 @@ div.spoiler
display: none; display: none;
} }
/* Header */
body.subpage {
padding-top: 3.125em;
}
#header {
background: #e4522f;
color: #e4522f;
cursor: default;
height: 3.25em;
left: 0;
line-height: 3.25em;
position: fixed;
text-align: right;
top: 0;
width: 100%;
z-index: 10001;
}
#header > h1 {
color:#000000;
display: inline-block;
height: inherit;
left: 1.25em;
line-height: inherit;
margin: 0;
padding: 0;
position: absolute;
top: 0;
}
#header > h1 a {
font-size: 1.25em;
}
#header > h1 a:hover {
color: #ffffff;
}
#header > h1 span {
font-weight: 300;
font-size: .8em;
}
#header > a {
-moz-transition: color 0.2s ease-in-out;
-webkit-transition: color 0.2s ease-in-out;
-ms-transition: color 0.2s ease-in-out;
transition: color 0.2s ease-in-out;
display: inline-block;
padding: 0 0.75em;
color: #ffffff;
text-decoration: none;
}
#header > a:hover {
color: #e4522f;
}
#header > a[href="#menu"]:hover {
color: #000000;
}
#header > a[href="#menu"] {
text-decoration: none;
font-size: larger;
-webkit-tap-highlight-color: transparent;
}
#header > a[href="#menu"]:before {
content: "";
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-transform: none !important;
}
#header > a[href="#menu"]:before {
margin: 0 0.5em 0 0;
}
#header > a + a[href="#menu"]:last-child {
border-left: solid 1px rgba(228, 82, 47, 0.15);
padding-left: 1.25em;
margin-left: 0.5em;
}
#header > a:last-child {
padding-right: 1.25em;
}
#logo
{
position: absolute;
left:0;
top:0;
}
@media screen and (max-width: 736px) {
#header > a {
padding: 0 0.5em;
}
#header > a + a[href="#menu"]:last-child {
padding-left: 1em;
margin-left: 0.25em;
}
#header > a:last-child {
padding-right: 1em;
}
}
@media screen and (max-width: 980px) {
body {
padding-top: 44px;
}
#header {
height: 44px;
line-height: 44px;
}
#header > h1 {
left: 1em;
}
#header > h1 a {
font-size: 1em;
}
}
@media screen and (max-width: 480px) {
#header {
min-width: 320px;
}
}
/* Menu */
#menu {
-moz-transform: translateX(20em);
-webkit-transform: translateX(20em);
-ms-transform: translateX(20em);
transform: translateX(20em);
-moz-transition: -moz-transform 0.5s ease, box-shadow 0.5s ease, visibility 0.5s;
-webkit-transition: -webkit-transform 0.5s ease, box-shadow 0.5s ease, visibility 0.5s;
-ms-transition: -ms-transform 0.5s ease, box-shadow 0.5s ease, visibility 0.5s;
transition: transform 0.5s ease, box-shadow 0.5s ease, visibility 0.5s;
-webkit-overflow-scrolling: touch;
background: #e4522f;
box-shadow: none;
color: #ffffff;
height: 100%;
max-width: 80%;
overflow-y: auto;
padding: 3em 2em;
position: fixed;
font-size: larger;
right: 0;
top: 0;
visibility: hidden;
width: 20em;
z-index: 10002;
}
#menu > ul {
margin: 0 0 1em 0;
}
#menu > ul.links {
list-style: none;
padding: 0;
}
#menu > ul.links > li {
padding: 0;
}
#menu > ul.links > li > a:not(.button) {
border: 0;
border-top: solid 1px rgba(255, 255, 255, 0.15);
color: inherit;
display: block;
line-height: 3.5em;
text-decoration: none;
}
#menu > ul.links > li > .button {
display: block;
margin: 0.5em 0 0 0;
}
#menu > ul.links > li > a:not(.button):hover {
color: rgba(255,255,255,0.2);
}
#menu > ul.links > li:first-child > a:not(.button) {
border-top: 0 !important;
}
#menu .close {
text-decoration: none;
-moz-transition: color 0.2s ease-in-out;
-webkit-transition: color 0.2s ease-in-out;
-ms-transition: color 0.2s ease-in-out;
transition: color 0.2s ease-in-out;
-webkit-tap-highlight-color: transparent;
border: 0;
color: #ffffff;
cursor: pointer;
display: block;
height: 2.75em;
line-height: 3.25em;
padding-right: 1.25em;
position: absolute;
right: 0;
text-align: right;
top: 0;
vertical-align: middle;
width: 2.75em;
}
#menu .close:before {
content: "";
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-transform: none !important;
}
#menu .close:before {
font-size: 1.25em;
}
#menu .close:hover {
color: rgba(255,255,255,0.2);
}
@media screen and (max-width: 736px) {
#menu .close {
height: 4em;
line-height: 4em;
}
}
#menu.visible {
-moz-transform: translateX(0);
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
box-shadow: 0 0 1.5em 0 rgba(0, 0, 0, 0.2);
visibility: visible;
}
@media screen and (max-width: 736px) {
#menu {
padding: 2.5em 1.75em;
}
}
/* Banner */ /* Banner */
@ -3910,6 +3592,9 @@ div.spoiler
/* Main */ /* Main */
/* Footer */ /* Footer */

View file

@ -1,6 +1,7 @@
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
{% load changelang %} {% load changelang %}
{% load avatar_tags %}
{% get_current_language as current_language %} {% get_current_language as current_language %}
<!DOCTYPE HTML> <!DOCTYPE HTML>
@ -21,67 +22,106 @@
<body class="subpage"> <body class="subpage">
<!-- Header --> <!-- Header -->
<header id="header">
<a href="{% url 'home' %}"><img src="{% static 'images/Ernestophone_white.png' %}"
style="float: left; width: auto; height: 3.1em;" alt="L'Ernestophone" title="white_esnesto" id="logo"></a>
<a href="#menu">Menu</a> <nav class="navbar navbar-expand-md">
</header> <div class="container-fluid">
<!-- Brand -->
<a class="navbar-brand" href="{% url 'home' %}"><img style='float:left;height:3em;width:auto' src='{% static "images/Ernestophone_white.png" %}'/></a>
<!-- Nav --> <!-- Links -->
<nav id="menu"> <ul class="navbar-nav mr-auto" >
<ul class="links">
<li>{% ifequal current_language "fr" %}
<a href="{% changelang "en" %}" >English<span class="image right"><img src="{% static "images/en_flag.jpg" %}"></span></a>
{% else %}
<a href="{% changelang "fr" %}">Français<span class="image right"><img src="{% static "images/fr_flag.jpg" %}"></span></a>
{% endifequal %}</li>
{% if not user.is_authenticated %} {% if not user.is_authenticated %}
<li class="nav-item">
<li><a href="{% url 'home' %}">{% trans "Accueil" %}</a></li> <a class="nav-link" href="{% url 'home' %}"><b>{% trans "Accueil" %}</b></a>
<li><a href="{% url 'calendrier:liste' %}">{% trans "Agenda" %}</a></li> </li>
{% else %} <li class="nav-item">
<li><a href="{% url 'calendrier:home' %}">{% trans "Agenda" %}</a></li> <a class="nav-link"href="{% url 'calendrier:liste' %}"><b>{% trans "Agenda" %}</b></a>
{% endif %} </li>
<li><a href="{% url 'partitions:liste' %}">{% trans "Répertoire" %}</a></li> {% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'calendrier:home' %}"><b>{% trans "Agenda" %}</b></a>
</li>
{% endif %}
<li class="nav-item">
<a class="nav-link" href="{% url 'partitions:liste' %}"><b>{% trans "Répertoire" %}</b></a>
</li>
{% if user.is_authenticated %} {% if user.is_authenticated %}
<li><a href="{% url 'instruments:liste' %}">{% trans "Instruments" %}</a></li> <li class="nav-item">
<li><a href="{% url 'pads:list' %}">{% trans "Pads" %}</a></li> <a class="nav-link" href="{% url 'instruments:liste' %}"><b>{% trans "Instruments" %}</b></a>
</ul> </li>
<h1>{% trans "Social :" %}</h1> <li class="nav-item">
<ul class ="links"> <a class="nav-link" href="{% url 'pads:list' %}"><b>{% trans "Pads" %}</b></a>
<li><a href="{% url 'trombonoscope:view' %}">{% trans "Trombonoscope" %}</a></li> </li>
<li><a href="https://photos.cof.ens.fr/index.php/Clubs-du-COF/L'Ernestophone" target="_blank">{% trans "Galerie Photo" %}</a></li> <!-- Dropdown -->
</ul> <li class="nav-item dropdown">
<h1> {% trans "Mon profil :" %}</h1> <a class="nav-link dropdown-toggle" href="{% url 'social' %}" id="navbardrop" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<ul class = 'links'> <b>{% trans 'Social'%}
<li><a href="{% url 'change_membre' %}">{% trans "Modification du profil" %}</a></li> </a>
<li><a href="{% url 'logout' %}">{% trans "Déconnexion" %}</a></li> <div class="dropdown-menu">
</ul> <a class="dropdown-item" href="{% url 'trombonoscope:view' %}">{% trans "Trombonoscope" %}</a>
<a class="dropdown-item" href="https://photos.cof.ens.fr/index.php/Clubs-du-COF/L'Ernestophone" target="_blank">{% trans "Galerie Photo" %}</a>
{% if user.is_superuser or user.profile.is_chef %} </div>
</ul> </li>
<h1>{% trans "Le pouvoir des chef·fe·s :" %}</h1> {% if user.is_superuser or user.profile.is_chef %}
<ul class="links"> <li class="nav-item dropdown">
<li><a href="/admin/">{% trans "Administration" %}</a></li> <a class="nav-link dropdown-toggle" href="{% url 'chef' %}" id="navbardrop" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<b>{% trans 'Le pouvoir des cheff·e·s'%}</b>
</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="/admin/">{% trans "Administration" %}</a>
{% if user.profile.is_chef %} {% if user.profile.is_chef %}
<li><a href="{% url 'actu:liste' %}">{% trans "Modifier les actualités" %}</a></li> <a class="dropdown-item" href="{% url 'calendrier:create_event' %}">{% trans "Ajouter un événement" %}</a>
{% endif %} <a class="dropdown-item" href="{% url 'actu:liste' %}">{% trans "Modifier les actualités" %}</a>
</ul>
{% endif %}
</ul>
{% else %}
<li><a href="{% url 'login' %}">{% trans "Se connecter" %}</a></li>
<li><a href="{% url 'registration' %}">{% trans "Créer un compte" %}</a></li>
</ul>
{% endif %} {% endif %}
</nav> </div>
</li>
{% endif %}
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'home' %}#contact"><b>{% trans "Contact" %}</b></a>
</li>
{% endif %}
</ul>
<ul class="navbar-nav" style="float:right">
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="{% url 'profile' %}" id="navbardrop" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{% if request.user|has_avatar %}
{% avatar request.user 50 class="rounded-circle"%}
{% else %}
<img src="{% static "images/Ernestophone_logo.png" %}" width="50" height="50" class="rounded-circle">
{% endif %}
</a>
<div class="dropdown-menu" >
<a class="dropdown-item" href="{% url 'change_membre' %}">{% trans "Modifier le profil" %}</a>
<a class="dropdown-item" href="{% url 'trombonoscope:change' %}">{% trans "Modifier le Trombo" %}</a>
<a class="dropdown-item" href="{% url 'logout' %}">{% trans "Déconnexion" %}</a>
</div>
</li>
{% else %}
<li class="nav-item"><a class="nav-link" href="{% url 'login' %}"><b>{% trans "Se connecter" %}</b></a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'registration' %}"><b>{% trans "Créer un compte" %}</a></li>
{% endif %}
<li class="nav-item">
{% ifequal current_language "fr" %}
<a class="nav-link" href="{% changelang "en" %}" ><img src="{% static 'images\en_flag.jpg' %}" width="60" height="40" class="rounded-circle"></a>
{% else %}
<a class="nav-link" href="{% changelang "fr" %}" ><img src="{% static 'images\fr_flag.jpg' %}" width="60" height="40" class="rounded-circle"></a>
{% endifequal %}
</li>
</ul>
</div>
</nav>
<!-- Main --> <!-- Main -->
@ -117,8 +157,41 @@
<script src="{% static 'js/main.js' %}"></script> <script src="{% static 'js/main.js' %}"></script>
<script src="{% static 'js/InstagramFeed.js' %}"></script> <script src="{% static 'js/InstagramFeed.js' %}"></script>
<script>
const $dropdown = $(".dropdown");
const $dropdownToggle = $(".dropdown-toggle");
const $dropdownMenu = $(".dropdown-menu");
const showClass = "show";
$(window).on("load resize", function() {
if (this.matchMedia("(min-width: 768px)").matches) {
$dropdown.hover(
function() {
const $this = $(this);
$this.addClass(showClass);
$this.find($dropdownToggle).attr("aria-expanded", "true");
$this.find($dropdownMenu).addClass(showClass);
},
function() {
const $this = $(this);
$this.removeClass(showClass);
$this.find($dropdownToggle).attr("aria-expanded", "false");
$this.find($dropdownMenu).removeClass(showClass);
}
);
} else {
$dropdown.off("mouseenter mouseleave");
}
});
</script>
<script type="text/javascript"> <script type="text/javascript">
function ouvrirFermerSpoiler(div) function ouvrirFermerSpoiler(div)
{ {
var divContenu = div.getElementsByTagName('div')[1]; var divContenu = div.getElementsByTagName('div')[1];

View file

@ -0,0 +1,23 @@
{% extends "gestion/base.html" %}
{% load i18n %}
{% block titre %}{% trans "Cheff·e·s" %}{% endblock %}
{% block content %}
<div id="main">
<section class="wrapper style1">
<div class="inner">
<div class="row">
<div class="6u 12u$(small)">
<h2>{% trans "Le pouvoir des cheff·e·s" %} :</h2>
<ul>
<li> <a href="/admin/">{% trans "Administration" %}</a></li>
<li> <a href="{% url 'calendrier:create_event' %}">{% trans "Ajouter un événement" %}</a></li>
<li><a href="{% url 'actu:liste' %}">{% trans "Modifier les actualités" %}</a></li>
</ul>
</div>
</div>
</div>
</section>
</div>
{% endblock %}

View file

@ -91,7 +91,7 @@
<!-- Two --> <!-- Two -->
<section class="wrapper style2" > <section class="wrapper style2" >
<div class="inner"> <div class="inner" id="contact">
<header> <header>
<h2>{% trans "L'Ernestophone in a nutshell" %}</h2> <h2>{% trans "L'Ernestophone in a nutshell" %}</h2>
<div id="instagram-feed" class="instagram_feed"> </div> <div id="instagram-feed" class="instagram_feed"> </div>
@ -241,7 +241,7 @@
{% endif %} {% endif %}
</span></div><p style="color:white" align="center">{% blocktrans %}Vous préparez un </span></div><p style="color:white" align="center">{% blocktrans %}Vous préparez un
évenement et vous recherchez une fanfare dynamique ? N'hésitez évenement et vous recherchez une fanfare dynamique ? N'hésitez
pas à nous envoyer un message nous serons ravis de venir pas à nous envoyer un message par mail ou sur Facebook. Nous serons ravis de venir
fanfaronner pour vous !! Vérifiez notre{% endblocktrans %} <a href="{% url 'calendrier:liste' %}" class="text">{% trans "agenda" %}</a>. <br /> fanfaronner pour vous !! Vérifiez notre{% endblocktrans %} <a href="{% url 'calendrier:liste' %}" class="text">{% trans "agenda" %}</a>. <br />
<a target="_blank" href="https://www.facebook.com/ernestophone" <a target="_blank" href="https://www.facebook.com/ernestophone"

View file

@ -0,0 +1,23 @@
{% extends "gestion/base.html" %}
{% load i18n %}
{% block titre %}{% trans "Profil" %}{% endblock %}
{% block content %}
<div id="main">
<section class="wrapper style1">
<div class="inner">
<div class="row">
<div class="6u 12u$(small)">
<h2>{% trans "Profil" %} :</h2>
<ul>
<li> <a href="{% url 'login' %}">{% trans "Se connecter" %}</a></li>
<li> <a href="{% url 'trombonoscope:change' %}">{% trans "Modifier le Trombo" %}</a></li>
<li><a href="{% url 'registration' %}">{% trans "Créer un compte" %}</a></li>
</ul>
</div>
</div>
</div>
</section>
</div>
{% endblock %}

View file

@ -0,0 +1,22 @@
{% extends "gestion/base.html" %}
{% load i18n %}
{% block titre %}{% trans "Social" %}{% endblock %}
{% block content %}
<div id="main">
<section class="wrapper style1">
<div class="inner">
<div class="row">
<div class="6u 12u$(small)">
<h2>{% trans "Social" %} :</h2>
<ul>
<li> <a href="{% url 'trombonoscope:view' %}">{% trans "Trombonoscope" %}</a></li>
<li><a href="https://photos.cof.ens.fr/index.php/Clubs-du-COF/L'Ernestophone" target="_blank">{% trans "Galerie Photo" %}</a></li>
</ul>
</div>
</div>
</div>
</section>
</div>
{% endblock %}

View file

@ -12,6 +12,7 @@ from django.views.generic import TemplateView
from calendrier.forms import ChangeDoodleName from calendrier.forms import ChangeDoodleName
from gestion.forms import (ChangeFormUser, ChangeMembreForm, from gestion.forms import (ChangeFormUser, ChangeMembreForm,
InscriptionMembreForm, RegistrationFormUser) InscriptionMembreForm, RegistrationFormUser)
from gestion.mixins import ChefRequiredMixin
from gestion.models import ErnestoUser, Photo, VideoGallery from gestion.models import ErnestoUser, Photo, VideoGallery
from partitions.models import Category from partitions.models import Category
@ -62,6 +63,18 @@ class Thanks(TemplateView):
template_name = "gestion/thanks.html" template_name = "gestion/thanks.html"
class Social(LoginRequiredMixin, TemplateView):
template_name = "gestion/social.html"
class Profil(LoginRequiredMixin, TemplateView):
template_name = "gestion/profile.html"
class Chef(ChefRequiredMixin, TemplateView):
template_name = "gestion/chef.html"
class ChangeName(LoginRequiredMixin, TemplateView): class ChangeName(LoginRequiredMixin, TemplateView):
form_class = ChangeDoodleName form_class = ChangeDoodleName
template_name = "gestion/changename.html" template_name = "gestion/changename.html"

View file

@ -38,7 +38,7 @@
{% for instrument in instrus_dispo %} {% for instrument in instrus_dispo %}
<tr> <tr>
<td> <a href="{% url "instruments:fiche_instru" instrument.id %}">{{ instrument.type }} </a></td> <td> <u> <a href="{% url "instruments:fiche_instru" instrument.id %}">{{ instrument.type }} </a></u></td>
<td> {{ instrument.owner }} </td> <td> {{ instrument.owner }} </td>
<td> {{ instrument.etat }} </td> <td> {{ instrument.etat }} </td>
<td> <td>
@ -74,7 +74,7 @@
{% for instrument in instrus_prete %} {% for instrument in instrus_prete %}
<tr> <tr>
<td> <a href="{% url "instruments:fiche_instru" instrument.id %}">{{ instrument.type }} </a> </td> <td> <u><a href="{% url "instruments:fiche_instru" instrument.id %}">{{ instrument.type }}</a></u></td>
<td> {{ instrument.owner }} </td> <td> {{ instrument.owner }} </td>
<td> {{ instrument.user }} </td> <td> {{ instrument.user }} </td>
<td> {{ instrument.etat}} </td> <td> {{ instrument.etat}} </td>

View file

@ -45,13 +45,9 @@ class CreateRep(ChefRequiredMixin, TemplateView):
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
form = self.form_class(request.POST) form = self.form_class(request.POST)
if form.is_valid(): if form.is_valid():
rep = Reparation() rep = form.save(commit=False)
rep.date = form.cleaned_data["date"]
rep.description = form.cleaned_data["description"]
rep.description_en = form.cleaned_data["description_en"]
rep.prix = form.cleaned_data["prix"]
rep.lieux = form.cleaned_data["lieux"]
rep.instru = get_object_or_404(Instrument, id=self.kwargs["pk"]) rep.instru = get_object_or_404(Instrument, id=self.kwargs["pk"])
rep.save() rep.save()
return redirect("instruments:fiche_instru", pk=self.kwargs["pk"]) return redirect("instruments:fiche_instru", pk=self.kwargs["pk"])