From 2d686d6c8059d67113697aa5a0d5fa7f09866522 Mon Sep 17 00:00:00 2001 From: giliam Date: Sat, 24 Jan 2015 01:41:53 +0100 Subject: [PATCH 1/9] Modif de config --- settings.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/settings.py b/settings.py index b87d3b1..150475a 100644 --- a/settings.py +++ b/settings.py @@ -125,6 +125,17 @@ 'django.contrib.messages.middleware.MessageMiddleware', ) +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'portail', + 'USER': 'root', + 'PASSWORD': 'robert42', + 'HOST': 'localhost', + 'PORT': '', + } +} + ROOT_URLCONF = 'urls' TEMPLATE_DIRS = ( @@ -171,7 +182,7 @@ 'mediamines', 'objettrouve', 'freshbox', - 'machines', + #'machines', #Avatar, pour les avatars de trombi 'avatar', #TinyMCE pour les messages From fdefe958d09eadecf3515fbd1a6e15f88456887a Mon Sep 17 00:00:00 2001 From: giliam Date: Wed, 9 Dec 2015 20:51:37 +0100 Subject: [PATCH 2/9] =?UTF-8?q?Corrige=20le=20bug=20de=20l'ajout=20de=20cl?= =?UTF-8?q?ip=20de=20l'app=20PR=20Mauvais=20import=20:=20vu=20qu'il=20s'ag?= =?UTF-8?q?issait=20d'un=20from=20datetime=20import=20datetime,=20on=20a?= =?UTF-8?q?=20directement=20acc=C3=A8s=20=C3=A0=20today.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pr/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr/models.py b/pr/models.py index d3b6893..54a06df 100644 --- a/pr/models.py +++ b/pr/models.py @@ -12,7 +12,7 @@ class Clip(models.Model): titre = models.CharField(max_length=100) lien = models.URLField() - promo = models.IntegerField(default=lambda : datetime.date.today().year-2002) + promo = models.IntegerField(default=lambda : datetime.today().year-2002) class Meta: ordering = ["-promo", "titre"] From 419dad32fd5ba8b3409f615ec9df55c2b5246536 Mon Sep 17 00:00:00 2001 From: giliam Date: Fri, 4 Mar 2016 21:52:55 +0100 Subject: [PATCH 3/9] Ignores virtualenv --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 1fabe2f..07bf44f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,8 @@ 1y1b/views.py 1y1b/views.py 1y1b/views.py + +bin/* +django/* +include/* +lib/* From efb8635f7ad99df9f7bd01e3787cbf72e238a11d Mon Sep 17 00:00:00 2001 From: giliam Date: Sat, 5 Mar 2016 01:09:24 +0100 Subject: [PATCH 4/9] Adds .gitignore for virtualenv and pip requirements. --- .gitignore | 4 ++++ requirements.txt | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 07bf44f..d584ab1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,7 @@ bin/* django/* include/* lib/* +build/* +local/* + +*.sql \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4239363 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,11 @@ +Django==1.5.2 +MySQL-python==1.2.5 +Pillow==3.1.1 +argparse==1.2.1 +beautifulsoup4==4.4.1 +bs4==0.0.1 +pycrypto==2.6.1 +python-dateutil==2.5.0 +six==1.10.0 +vobject==0.9.1 +wsgiref==0.1.2 From 1ab36fac2c911ceacbb02c2bf41378c051b6b89a Mon Sep 17 00:00:00 2001 From: giliam Date: Sat, 5 Mar 2016 01:10:25 +0100 Subject: [PATCH 5/9] Adds try catch on Image (PIL) import. --- machines/views.py | 8 +++++++- trombi/views.py | 8 +++++++- trombiassos/views.py | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/machines/views.py b/machines/views.py index 9d1c675..50516f3 100644 --- a/machines/views.py +++ b/machines/views.py @@ -11,7 +11,13 @@ from urllib import urlretrieve import subprocess import vobject -import Image +try: + import Image +except ImportError: + try: + from PIL import Image + except ImportError: + raise ImportError("The Python Imaging Library was not found.") import json import os from machines.models import MachineProfile diff --git a/trombi/views.py b/trombi/views.py index ada1f8b..ae8359b 100644 --- a/trombi/views.py +++ b/trombi/views.py @@ -16,7 +16,13 @@ from django.views.generic import CreateView, UpdateView, DeleteView import subprocess import vobject -import Image +try: + import Image +except ImportError: + try: + from PIL import Image + except ImportError: + raise ImportError("The Python Imaging Library was not found.") import json import os from settings import SECRET_KEY_UPDATE diff --git a/trombiassos/views.py b/trombiassos/views.py index cf6e69c..a0b908c 100644 --- a/trombiassos/views.py +++ b/trombiassos/views.py @@ -17,7 +17,13 @@ from django.views.generic import CreateView, UpdateView, DeleteView import subprocess import vobject -import Image +try: + import Image +except ImportError: + try: + from PIL import Image + except ImportError: + raise ImportError("The Python Imaging Library was not found.") import json import os from settings import SECRET_KEY_UPDATE From 68315020c274f341287cbf52f5694b0d352cc86d Mon Sep 17 00:00:00 2001 From: giliam Date: Sat, 5 Mar 2016 02:07:22 +0100 Subject: [PATCH 6/9] Adds arrows to the profiles to go to previous and next person in the promo. --- public/static/css/trombi.css | 21 +++++++++++++++++++++ public/static/img/left_arrow.png | Bin 0 -> 867 bytes public/static/img/right_arrow.png | Bin 0 -> 887 bytes templates/trombi/detail.html | 5 +++++ trombi/views.py | 7 ++++++- 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 public/static/img/left_arrow.png create mode 100644 public/static/img/right_arrow.png diff --git a/public/static/css/trombi.css b/public/static/css/trombi.css index 4c6dd4f..a5dcc0e 100644 --- a/public/static/css/trombi.css +++ b/public/static/css/trombi.css @@ -70,4 +70,25 @@ li.portrait img { h1.promo { font-size:30pt; text-align:center; +} + +p#fleches_profils { + display:block; + width:100%; + margin-bottom:0px; + height:55px; +} + +.fleche_gauche { + float:left; + display:block; +} + +.fleche_droite { + float:right; + display:block; +} + +.fleche_minimisee { + height:50px; } \ No newline at end of file diff --git a/public/static/img/left_arrow.png b/public/static/img/left_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..28dc31b6eb465c5a0b5f5945242eb030de6b55db GIT binary patch literal 867 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSoCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#0W&Luf??hk`3MFEW+qP;$B>F!Z|7|6yX+w1dcRm`$yKpvg(vDPvb?7Chw?up zdekt+JM_9VXS_)0anT6lSU6#)$QoCU#Hn|WB)+j+en;z~<>zCP)wv+cv4P~H$G#AKi6B*8N)>#TxzD4l&z=<`_IAL(eZwg*opN94IL4lv*e4PJfBm)pn`?b z9b<^uia0)H_h36=dWlNw;g*&$Ku>;wG5MT_QuU# zvir>P6cde^#y2ivT5m8t6onLclyN0eoL*vuaclCq4#9!zbG%S4b zopHx+t)(UGQ(4&xn0~&Va!IBa%(7f+;+)vX$fLPGUt#H$1?vwmOo%UJII-TMLHNXT z#`BCBZd*Q0jDN(E@HAY8;gdEW!%xw8<}aVxYkrCSZ1rOZt2@dVV|$=;PSehpj|!h$ zmv!2_zQ*%}yx{M=tJSOxf4bH)O8mWik84)43)9rO%nXb$cwowT#xrMbZM*u6TV`Fg zwR+EUo`m-=@h Vv(}w@x>^#X!qe5yWt~$(69D4oPDcO$ literal 0 HcmV?d00001 diff --git a/public/static/img/right_arrow.png b/public/static/img/right_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..1c1992c69473fbee9491206597c7ea54e7962a62 GIT binary patch literal 887 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSoCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#0W&LuB7<6?o-zXivzVugV@SoVw{s762|J3o-hb`W;>gmQAl}4n{>bfv@gG+E zGxG}`rtc_zdu;Ba*ls}=w!q0%dOmHQGBZ7Qt-5^my^KU#%T1N*=b< z{qEK#X=U~;A4D1d^mQCN^R7)`pK`-yu^lRnvu?f>IAqE6W7-3gmJh;=T1rc|oH6AK z2|fEJjN_p>)0NGi&Ifsk>t0ySX{I#erYA>YD?_QwiM_s>xw-$JO>l6TCE%1Kzko@s z`)GA&t<~(a+sx{VE|$){#GssJH-Ep_#C7ja{g-dgGrP#Zd}-U;)mO8=Zpxfhts3

1h_Rls{XxGqH18qO2>cH?^sDQ`dj-jKVnfXc?ElJ)7 zdpJva^qGE5b-G^aTgJ#yH%rK*#s1)zvtO2NpHnPgk;u8Jhav3$7I#KogWPqo4>%sk zusAS4-~*G!y$xCZKd#@8s`^>jGx4&6xpt*`O{nipsRpqX>p1gj3_DIA6fRkC;%UN* z^D229jW1iyJ3c6QxLoGG;SB2N!0_<&348SphI46lOae&Af?u9- zPJ2JYxx?-Z&mSr`eEuMKpz;UD1DhI_0y#S-3;y^PX(zXXhW~SAcnh9ftv~Z2li|3w zJR^rZ;~orcZ + + +

+
diff --git a/trombi/views.py b/trombi/views.py index ae8359b..f9a0b64 100644 --- a/trombi/views.py +++ b/trombi/views.py @@ -53,12 +53,17 @@ def trombi_json(request): def detail(request, mineur_login): """Page de profil d'un élève""" mineur = get_object_or_404(UserProfile, user__username = mineur_login) + + mineurs_promo = UserProfile.objects.filter(promo=mineur.promo) + mineur_apres = mineurs_promo.filter(user__username__gt=mineur_login)[0] + mineur_avant = mineurs_promo.filter(user__username__lt=mineur_login).order_by('-user__username')[0] + assoces = Adhesion.objects.filter(eleve = mineur) if request.user.get_profile().en_premiere_annee(): assoces = assoces.exclude(association__is_hidden_1A = True) liste_questions = Question.objects.all() liste_reponses = mineur.reponses.all() - return render_to_response('trombi/detail.html', {'mineur': mineur.user, 'assoces': assoces, 'liste_questions': liste_questions, 'liste_reponses': liste_reponses},context_instance=RequestContext(request)) + return render_to_response('trombi/detail.html', {'mineur': mineur.user, 'assoces': assoces, 'liste_questions': liste_questions, 'liste_reponses': liste_reponses, 'mineur_apres': mineur_apres, 'mineur_avant': mineur_avant},context_instance=RequestContext(request)) @login_required def detail_json(request, mineur_login): From 9961199caff8c9d27fc86dbf87429e4b71624537 Mon Sep 17 00:00:00 2001 From: giliam Date: Sat, 5 Mar 2016 02:18:45 +0100 Subject: [PATCH 7/9] Adds arrow control. --- templates/trombi/detail.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/templates/trombi/detail.html b/templates/trombi/detail.html index 97dbf03..ee0725d 100644 --- a/templates/trombi/detail.html +++ b/templates/trombi/detail.html @@ -115,4 +115,17 @@

{{ mineur.get_profile.first_name }} {% if mineur.get_profile.surnom %}"{{ mi {% endif %} + + {% endblock %} From 487b6f96d6af91c5e49aea00ee02e0c869e5c002 Mon Sep 17 00:00:00 2001 From: giliam Date: Sat, 5 Mar 2016 02:23:42 +0100 Subject: [PATCH 8/9] Rolls back settings changes. --- settings.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/settings.py b/settings.py index 5dc03d3..2de18c9 100644 --- a/settings.py +++ b/settings.py @@ -125,17 +125,6 @@ 'django.contrib.messages.middleware.MessageMiddleware', ) -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'portail', - 'USER': 'root', - 'PASSWORD': 'robert42', - 'HOST': 'localhost', - 'PORT': '', - } -} - ROOT_URLCONF = 'urls' TEMPLATE_DIRS = ( From 8eb0a999790bebffebd5ed4a5691acffe616bd9a Mon Sep 17 00:00:00 2001 From: giliam Date: Sat, 5 Mar 2016 02:34:23 +0100 Subject: [PATCH 9/9] Adds README "how-to install" --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4516a76 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +Requirements +=== +Python >= 2.7.6 +Django 1.5.2 + + +Comment installer le portail sur votre ordinateur +=== + +* Installer pip +* Installer git +* Installer Virtualenv (*pip install virtualenv*) +* Aller dans le dossier où vous voulez installer le portail +* Créer un virtual (virtualenv env/) +* Se mettre sur le virtualenv en question (source env/bin/activate) + +* Une fois tout cela fait, se créer un compte sur github.com +* Forker le portail (https://github.com/ensmp/portail) +* Cloner le dépôt (git clone https://github.com/ensmp/portail) + +* Installer les requirements (pip install -r requirements.txt) +* Ajouter toutes les autres dépendances (MysqlDb, Pillow, etc.) \ No newline at end of file