From 165894c92b17ad69fc032bfd9ecaa1d4ffdbc96e Mon Sep 17 00:00:00 2001 From: Soriba SYLLA Date: Fri, 18 Sep 2026 09:31:46 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Nom=20des=20produits=20doivent=20=C3=AAt?= =?UTF-8?q?re=20unique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 51 ++++++++++++++++++ SGL/__pycache__/settings.cpython-310.pyc | Bin 2901 -> 2901 bytes .../__pycache__/models.cpython-310.pyc | Bin 4585 -> 4600 bytes .../__pycache__/views.cpython-310.pyc | Bin 14477 -> 14477 bytes gestion_produit/models.py | 6 ++- gestion_produit/views.py | 2 - 6 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..ee9f705 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,51 @@ +pipeline +{ + agent any + options { + skipDefaultCheckout(true) + } + + environment + { + SUDO_PASSWORD = credentials('sudo-password') + } + + stages + { + stage ( 'checkout' ) + { + steps + { + sh 'echo "Debut du pipeline"' + cleanWs() + checkout scm + } + } + stage ( 'Deploiement' ) + { + when { branch 'main' } + steps { + sh ''' + cd /var/www/sgl + echo $SUDO_PASSWORD | sudo -S chown -R jenkins:jenkins /var/www/sgl + + git fetch origin main + git reset --hard origin/main + + python3 -m venv venv + . venv/bin/activate + pip install -r requirements.txt + + python manage.py makemigrations + python manage.py migrate + echo $SUDO_PASSWORD | sudo -S rm -r staticfiles + python manage.py collectstatic --noinput + + echo $SUDO_PASSWORD | sudo -S chown -R www-data:www-data /var/www/sgl + echo "Deploiement reussi" + echo $SUDO_PASSWORD | sudo -S supervisorctl restart sgl + ''' + } + } + } +} \ No newline at end of file diff --git a/SGL/__pycache__/settings.cpython-310.pyc b/SGL/__pycache__/settings.cpython-310.pyc index c8e82441621d4052c2a3bcde460854eba5895284..549db9d175ab2f7068008d4dc28ad2d23f692f03 100644 GIT binary patch delta 20 acmcaAc2$f!pO=@50SKB8F5bxP#SH*DpapFJ delta 20 acmcaAc2$f!pO=@50SJ!yPuHpO=@50SI!L)@B{p$jibURs!UuGDI<^Fhnt>Fh((_Fh#MXvSzWRFsHDj zu%@u}GDook`5YnZmJ}|a92Z!Q8!X2SWb>r(0CllWPGvqU5u(X_ zi>EBLC@H@T`qv1@XOz)8mH$#R0nSk;7N#nb_m CbvHBs delta 221 zcmeyN{8E`WpO=@50SJ!yPtEGx$jibUQUv6sGDI<^Fhnt>Fh((_Fh#MXvSzWRFsHDj zu=X-Vu>*M=DQqe1y^K+uU>S}SmQSq64&>gMo#Sg^7=Yg^`Jo?LQ0i z@DQW=jG*M00MR9wOQBQHuC*qW0c;^$sWeUn6Np4a}6V--)3I!pNxzhli7JE zF;;D!#oNTh*uPm;;35;_>CNwjj2OAs0ks#)00|+%%{n6gm>4fl))xQ4_+_(-ge@b} zKZec8k`EXeg(ka5_cQWrz9QYi$f&eAQnrVc(P;BCr35C%lFja_K_F9Ssn23!+&9@& z>mK9E%_7?N%#0^Chv@BOWc;z2&wzsks7>6YijmP|^CVL?Mn=xfGtJgAN;B~=$uLQ9 bFmZAHWisYs@DQW=jG*M0D@!wQ?mr!H}d^rW0cv<$sWeUn7BECa}6V-|7Kq9pNx#1li7JE zF;;J$#oNThIAOD_z(pp;vzy-w88LFN2Wl^t0TMz&n{`C~F)?19tS$b7@!Mt<30p=c z2FA_Fk`EXeMJBsQ_cQWsz9QYi$f&Y8QnrVc(PZ;8r35C%vd!+QK}?JjH_uX^#l(1E zvZ>ZR#?_lewC$N0Pi+p-+sVlIYcrn#2MbV}xJeZwquJ(3rfiIi+?!{bt!0#E=3$ay dlHg$C;`+;E%*Du|%_Pdj$Rr2Es*@8fbO07JK8pYV diff --git a/gestion_produit/models.py b/gestion_produit/models.py index b69478b..02d6baa 100644 --- a/gestion_produit/models.py +++ b/gestion_produit/models.py @@ -25,7 +25,11 @@ class Produit(models.Model): ("carton", "Carton"), ) - libelle = models.CharField(verbose_name="Libellé", max_length=255) + libelle = models.CharField( + verbose_name="Libellé", + max_length=255, + unique=True + ) quantite_stock = models.PositiveIntegerField( verbose_name="Quantité actuellement en stock" ) diff --git a/gestion_produit/views.py b/gestion_produit/views.py index 5019d69..b491173 100644 --- a/gestion_produit/views.py +++ b/gestion_produit/views.py @@ -5,7 +5,6 @@ from django.core.paginator import Paginator from django.db.models import Sum from authentification.models import Profile -# from django.views.decorators.csrf import csrf_exempt from django.contrib.auth.decorators import login_required from django.http import JsonResponse @@ -189,7 +188,6 @@ def detail_produit(request, id_produit): Réponse JSON contenant les détails du produit. """ - detail_produit = calcul_stock_produit(Produit.objects.get(id=id_produit)) categories = Categorie.objects.all()