Merge branch 'py3' into 'master'

Passage à python 3

See merge request klub-dev-ens/experiENS!4
This commit is contained in:
Robin Champenois 2018-12-26 23:39:47 +01:00
commit 85de4f0245
17 changed files with 115 additions and 103 deletions

View file

@ -3,11 +3,13 @@ ExpériENS : partagez votre stage
ExpériENS est un projet visant à faire un "Annuaire de stage", afin de partager vos ressentis concernant les lieux, les personnes, tout ce qui a fait votre séjour. ExpériENS est un projet visant à faire un "Annuaire de stage", afin de partager vos ressentis concernant les lieux, les personnes, tout ce qui a fait votre séjour.
Il est visible sur https://www.eleves.ens.fr/experiens/
## Développer sur son ordinateur ## Développer sur son ordinateur
Clonez le dépôt. Installez les pré-requis : Clonez le dépôt. Installez les pré-requis :
sudo apt-get install libxlst-dev python2.7-dev sudo apt-get install libxlst-dev python3.4-dev
On a besoin de SpatiaLite pour une base de données GIS. Essayez On a besoin de SpatiaLite pour une base de données GIS. Essayez
@ -28,10 +30,10 @@ Ensuite, paramétrez les settings :
Enfin, installez les autres dépendances : Enfin, installez les autres dépendances :
virtualenv venv python3 -m venv venv
. venv/bin/activate . venv/bin/activate
pip install -r requirements.txt pip install --update pip
pip install -r requirements_dev.txt pip install -r requirements-dev.txt
python manage.py makemigrations python manage.py makemigrations
python manage.py migrate python manage.py migrate

View file

@ -20,7 +20,7 @@ class Command(BaseCommand):
if options.get('apply', False): if options.get('apply', False):
rundb = True rundb = True
else: else:
print u"Les modifications ne seront pas appliquées" print(u"Les modifications ne seront pas appliquées")
min_lieu = options.get('min_lieu', 0) min_lieu = options.get('min_lieu', 0)
@ -28,16 +28,16 @@ class Command(BaseCommand):
lproches = Lieu.objects.filter(id__lt=lieu.id, coord__distance_lte=(lieu.coord, 5)) lproches = Lieu.objects.filter(id__lt=lieu.id, coord__distance_lte=(lieu.coord, 5))
if len(lproches) == 0: if len(lproches) == 0:
continue continue
print u"Doublons possibles pour %s (id=%d, %d avis) :" % (lieu, lieu.id, lieu.avislieu_set.count()) print(u"Doublons possibles pour %s (id=%d, %d avis) :" % (lieu, lieu.id, lieu.avislieu_set.count()))
for plieu in lproches: for plieu in lproches:
pprint = u" > %s (id=%d, %d avis)" % (plieu, plieu.id, plieu.avislieu_set.count()) pprint = u" > %s (id=%d, %d avis)" % (plieu, plieu.id, plieu.avislieu_set.count())
if plieu.nom == lieu.nom and plieu.ville == lieu.ville and plieu.type_lieu == lieu.type_lieu: if plieu.nom == lieu.nom and plieu.ville == lieu.ville and plieu.type_lieu == lieu.type_lieu:
print u"%s %s" % (pprint, self.style.SUCCESS(u'-> Suppression')) print(u"%s %s" % (pprint, self.style.SUCCESS(u'-> Suppression')))
if rundb: if rundb:
for avis in plieu.avislieu_set.all(): for avis in plieu.avislieu_set.all():
avis.lieu = lieu avis.lieu = lieu
avis.save() avis.save()
plieu.delete() plieu.delete()
else: else:
print u"%s %s" % (pprint, self.style.WARNING(u'-> À supprimer manuellement')) print(u"%s %s" % (pprint, self.style.WARNING(u'-> À supprimer manuellement')))
self.stdout.write(self.style.SUCCESS(u'Nettoyage des lieux effectué')) self.stdout.write(self.style.SUCCESS(u'Nettoyage des lieux effectué'))

View file

@ -30,7 +30,7 @@ class Command(BaseCommand):
if options.get('apply', False): if options.get('apply', False):
rundb = True rundb = True
else: else:
print u"Les modifications ne seront pas appliquées" print(u"Les modifications ne seront pas appliquées")
min_stage = options.get('min_stage', 0) min_stage = options.get('min_stage', 0)
@ -52,15 +52,15 @@ class Command(BaseCommand):
problems += [(avis, alen), lieuset[aid]] problems += [(avis, alen), lieuset[aid]]
lieuset[aid] = (avis, alen) lieuset[aid] = (avis, alen)
if len(todel) > 0: if len(todel) > 0:
print u"Doublons détectés dans %s" % (stage,) print(u"Doublons détectés dans %s" % (stage,))
for avis, alen in todel: for avis, alen in todel:
print u" > Suppression de l'avis sur %s de %d mots" % \ print(u" > Suppression de l'avis sur %s de %d mots" % \
(avis.lieu, alen) (avis.lieu, alen))
if rundb: if rundb:
avis.delete() avis.delete()
if len(problems) > 0: if len(problems) > 0:
self.stdout.write(self.style.WARNING(u"Réparation impossible de %s (id=%d)" % (stage, stage.id))) self.stdout.write(self.style.WARNING(u"Réparation impossible de %s (id=%d)" % (stage, stage.id)))
for avis, alen in problems: for avis, alen in problems:
print u" > Avis sur %s de %d mots" % \ print(u" > Avis sur %s de %d mots" % \
(avis.lieu, alen) (avis.lieu, alen))
self.stdout.write(self.style.SUCCESS(u'Nettoyage des stages effectué')) self.stdout.write(self.style.SUCCESS(u'Nettoyage des stages effectué'))

View file

@ -21,12 +21,12 @@ class Command(BaseCommand):
if options.get('apply', False): if options.get('apply', False):
rundb = True rundb = True
else: else:
print u"Les modifications ne seront pas appliquées" print(u"Les modifications ne seront pas appliquées")
plieu = Lieu.objects.get(id=options['del_lieu']) plieu = Lieu.objects.get(id=options['del_lieu'])
lieu = Lieu.objects.get(id=options['repl_lieu']) lieu = Lieu.objects.get(id=options['repl_lieu'])
print u"Suppression de %s (id=%d, %d avis)" % (plieu, plieu.id, plieu.avislieu_set.count()) print(u"Suppression de %s (id=%d, %d avis)" % (plieu, plieu.id, plieu.avislieu_set.count()))
print u"Remplacement par %s (id=%d, %d avis)" % (lieu, lieu.id, lieu.avislieu_set.count()) print(u"Remplacement par %s (id=%d, %d avis)" % (lieu, lieu.id, lieu.avislieu_set.count()))
if rundb: if rundb:
for avis in plieu.avislieu_set.all(): for avis in plieu.avislieu_set.all():
avis.lieu = lieu avis.lieu = lieu

View file

@ -40,7 +40,7 @@ class Normalien(models.Model):
verbose_name = u"Profil élève" verbose_name = u"Profil élève"
verbose_name_plural = u"Profils élèves" verbose_name_plural = u"Profils élèves"
def __unicode__(self): def __str__(self):
return u"%s (%s)" % (self.nom, self.user.username) return u"%s (%s)" % (self.nom, self.user.username)
# Liste des stages publiés # Liste des stages publiés
@ -131,7 +131,7 @@ class Lieu(models.Model):
def type_lieu_fem(self): def type_lieu_fem(self):
return TYPE_LIEU_DICT.get(self.type_lieu, ("lieu", False))[1] return TYPE_LIEU_DICT.get(self.type_lieu, ("lieu", False))[1]
def __unicode__(self): def __str__(self):
return u"%s (%s)" % (self.nom, self.ville) return u"%s (%s)" % (self.nom, self.ville)
class Meta: class Meta:
@ -150,7 +150,7 @@ class StageMatiere(models.Model):
verbose_name = "Matière des stages" verbose_name = "Matière des stages"
verbose_name_plural = "Matières des stages" verbose_name_plural = "Matières des stages"
def __unicode__(self): def __str__(self):
return self.nom return self.nom
# #
@ -221,7 +221,7 @@ class Stage(models.Model):
def get_absolute_url(self): def get_absolute_url(self):
return reverse('avisstage:stage', self) return reverse('avisstage:stage', self)
def __unicode__(self): def __str__(self):
return u"%s (par %s)" % (self.sujet, self.auteur.user.username) return u"%s (par %s)" % (self.sujet, self.auteur.user.username)
def update_stats(self, save=True): def update_stats(self, save=True):
@ -263,7 +263,7 @@ class AvisStage(models.Model):
les_plus = models.TextField(u"Les plus de cette expérience", blank=True) les_plus = models.TextField(u"Les plus de cette expérience", blank=True)
les_moins = models.TextField(u"Les moins de cette expérience", blank=True) les_moins = models.TextField(u"Les moins de cette expérience", blank=True)
def __unicode__(self): def __str__(self):
return u"Avis sur {%s} par %s" % (self.stage.sujet, self.stage.auteur.user.username) return u"Avis sur {%s} par %s" % (self.stage.sujet, self.stage.auteur.user.username)
# Liste des champs d'avis, couplés à leur nom (pour l'affichage) # Liste des champs d'avis, couplés à leur nom (pour l'affichage)
@ -292,7 +292,7 @@ class AvisLieu(models.Model):
verbose_name = "Avis sur un lieu de stage" verbose_name = "Avis sur un lieu de stage"
verbose_name_plural = "Avis sur un lieu de stage" verbose_name_plural = "Avis sur un lieu de stage"
def __unicode__(self): def __str__(self):
return u"Avis sur {%s} par %s" % (self.lieu.nom, self.stage.auteur.user_id) return u"Avis sur {%s} par %s" % (self.lieu.nom, self.stage.auteur.user_id)
# Liste des champs d'avis, couplés à leur nom (pour l'affichage) # Liste des champs d'avis, couplés à leur nom (pour l'affichage)

View file

@ -542,6 +542,8 @@ ul.as-selections {
div.as-results { div.as-results {
position: relative; position: relative;
z-index: 2;
ul { ul {
position: absolute; position: absolute;
width: 100%; width: 100%;

View file

@ -900,28 +900,29 @@ ul.as-selections .as-original input {
/* line 543, ../../sass/screen.scss */ /* line 543, ../../sass/screen.scss */
div.as-results { div.as-results {
position: relative; position: relative;
z-index: 2;
} }
/* line 545, ../../sass/screen.scss */ /* line 547, ../../sass/screen.scss */
div.as-results ul { div.as-results ul {
position: absolute; position: absolute;
width: 100%; width: 100%;
background: #fff; background: #fff;
border: 1px solid #d2ebad; border: 1px solid #d2ebad;
} }
/* line 552, ../../sass/screen.scss */ /* line 554, ../../sass/screen.scss */
div.as-results ul li { div.as-results ul li {
padding: 3px 5px; padding: 3px 5px;
} }
/* line 558, ../../sass/screen.scss */ /* line 560, ../../sass/screen.scss */
div.as-results ul li.as-result-item.active { div.as-results ul li.as-result-item.active {
background: #fddeb5; background: #fddeb5;
} }
/* line 563, ../../sass/screen.scss */ /* line 565, ../../sass/screen.scss */
div.as-results ul li.as-message { div.as-results ul li.as-message {
font-style: italic; font-style: italic;
} }
/* line 573, ../../sass/screen.scss */ /* line 575, ../../sass/screen.scss */
.window { .window {
display: none; display: none;
position: fixed; position: fixed;
@ -932,11 +933,11 @@ div.as-results ul li.as-message {
left: 0; left: 0;
z-index: 50; z-index: 50;
} }
/* line 583, ../../sass/screen.scss */ /* line 585, ../../sass/screen.scss */
.window.visible { .window.visible {
display: block; display: block;
} }
/* line 587, ../../sass/screen.scss */ /* line 589, ../../sass/screen.scss */
.window .window-bg { .window .window-bg {
background: #000; background: #000;
opacity: 0.7; opacity: 0.7;
@ -947,7 +948,7 @@ div.as-results ul li.as-message {
top: 0; top: 0;
z-index: -1; z-index: -1;
} }
/* line 598, ../../sass/screen.scss */ /* line 600, ../../sass/screen.scss */
.window .window-content { .window .window-content {
position: relative; position: relative;
margin: 0 auto; margin: 0 auto;
@ -961,11 +962,11 @@ div.as-results ul li.as-message {
max-height: 100%; max-height: 100%;
overflow: auto; overflow: auto;
} }
/* line 612, ../../sass/screen.scss */ /* line 614, ../../sass/screen.scss */
.window .window-content form label, .window .window-content form .label { .window .window-content form label, .window .window-content form .label {
width: 150px; width: 150px;
} }
/* line 618, ../../sass/screen.scss */ /* line 620, ../../sass/screen.scss */
.window .window-closer { .window .window-closer {
position: absolute; position: absolute;
top: 0; top: 0;
@ -973,65 +974,65 @@ div.as-results ul li.as-message {
padding: 12px; padding: 12px;
z-index: 3; z-index: 3;
} }
/* line 624, ../../sass/screen.scss */ /* line 626, ../../sass/screen.scss */
.window .window-closer:after { .window .window-closer:after {
content: "×"; content: "×";
} }
/* line 635, ../../sass/screen.scss */ /* line 637, ../../sass/screen.scss */
#lieu_widget .lieu-ui { #lieu_widget .lieu-ui {
position: relative; position: relative;
} }
/* line 637, ../../sass/screen.scss */ /* line 639, ../../sass/screen.scss */
#lieu_widget .lieu-ui .map { #lieu_widget .lieu-ui .map {
height: 400px; height: 400px;
width: 100%; width: 100%;
} }
/* line 641, ../../sass/screen.scss */ /* line 643, ../../sass/screen.scss */
#lieu_widget .lieu-ui.hidden { #lieu_widget .lieu-ui.hidden {
display: none; display: none;
} }
/* line 644, ../../sass/screen.scss */ /* line 646, ../../sass/screen.scss */
#lieu_widget .lieu-ui .masked { #lieu_widget .lieu-ui .masked {
visibility: hidden; visibility: hidden;
} }
/* line 649, ../../sass/screen.scss */ /* line 651, ../../sass/screen.scss */
#lieu_widget .lieu-choixmodif { #lieu_widget .lieu-choixmodif {
display: none; display: none;
} }
/* line 654, ../../sass/screen.scss */ /* line 656, ../../sass/screen.scss */
#lieu_widget.modif .lieu-choixmodif { #lieu_widget.modif .lieu-choixmodif {
display: unset; display: unset;
} }
/* line 659, ../../sass/screen.scss */ /* line 661, ../../sass/screen.scss */
#lieu_widget.modif .lieu-ui, #lieu_widget.attente .lieu-ui { #lieu_widget.modif .lieu-ui, #lieu_widget.attente .lieu-ui {
display: none; display: none;
} }
/* line 666, ../../sass/screen.scss */ /* line 668, ../../sass/screen.scss */
#lieu_widget.edit .lieu-ui .lieu-acinput { #lieu_widget.edit .lieu-ui .lieu-acinput {
display: none; display: none;
} }
/* line 669, ../../sass/screen.scss */ /* line 671, ../../sass/screen.scss */
#lieu_widget.edit .lieu-ui .map { #lieu_widget.edit .lieu-ui .map {
height: 200px; height: 200px;
} }
/* line 675, ../../sass/screen.scss */ /* line 677, ../../sass/screen.scss */
#lieu_widget #avis_lieu_vide { #lieu_widget #avis_lieu_vide {
display: none; display: none;
} }
/* line 679, ../../sass/screen.scss */ /* line 681, ../../sass/screen.scss */
#lieu_widget .message { #lieu_widget .message {
background: #fddeb5; background: #fddeb5;
padding: 5px; padding: 5px;
font-style: italic; font-style: italic;
font-size: 0.9em; font-size: 0.9em;
} }
/* line 685, ../../sass/screen.scss */ /* line 687, ../../sass/screen.scss */
#lieu_widget .message.hidden { #lieu_widget .message.hidden {
display: none; display: none;
} }
/* line 691, ../../sass/screen.scss */ /* line 693, ../../sass/screen.scss */
a.lieu-change { a.lieu-change {
color: #fff; color: #fff;
background: #f99b20; background: #f99b20;
@ -1044,25 +1045,25 @@ a.lieu-change {
border-radius: 5px; border-radius: 5px;
margin-right: 7px; margin-right: 7px;
} }
/* line 703, ../../sass/screen.scss */ /* line 705, ../../sass/screen.scss */
a.lieu-change.ajout:before { a.lieu-change.ajout:before {
content: "+"; content: "+";
margin-right: 5px; margin-right: 5px;
} }
/* line 709, ../../sass/screen.scss */ /* line 711, ../../sass/screen.scss */
#stages-map { #stages-map {
width: 100%; width: 100%;
height: 600px; height: 600px;
max-height: 90vh; max-height: 90vh;
} }
/* line 716, ../../sass/screen.scss */ /* line 718, ../../sass/screen.scss */
#id_stage-thematiques { #id_stage-thematiques {
display: none; display: none;
} }
/* line 722, ../../sass/screen.scss */ /* line 724, ../../sass/screen.scss */
.homeh1 { .homeh1 {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -1072,26 +1073,26 @@ a.lieu-change.ajout:before {
border-bottom: 3px solid #000; border-bottom: 3px solid #000;
margin-bottom: 15px; margin-bottom: 15px;
} }
/* line 731, ../../sass/screen.scss */ /* line 733, ../../sass/screen.scss */
.homeh1 h1 { .homeh1 h1 {
margin-bottom: 3px; margin-bottom: 3px;
} }
/* line 735, ../../sass/screen.scss */ /* line 737, ../../sass/screen.scss */
.homeh1 > * { .homeh1 > * {
display: inline-block; display: inline-block;
} }
/* line 738, ../../sass/screen.scss */ /* line 740, ../../sass/screen.scss */
.homeh1 p { .homeh1 p {
text-align: right; text-align: right;
} }
/* line 743, ../../sass/screen.scss */ /* line 745, ../../sass/screen.scss */
.betacadre { .betacadre {
background: #fa6cae; background: #fa6cae;
padding: 10px; padding: 10px;
} }
/* line 748, ../../sass/screen.scss */ /* line 750, ../../sass/screen.scss */
.entrer { .entrer {
background: #fff; background: #fff;
max-width: 500px; max-width: 500px;
@ -1100,84 +1101,84 @@ a.lieu-change.ajout:before {
margin: 15px auto; margin: 15px auto;
} }
/* line 756, ../../sass/screen.scss */ /* line 758, ../../sass/screen.scss */
article.promo { article.promo {
display: block; display: block;
font-size: 1.1em; font-size: 1.1em;
} }
/* line 760, ../../sass/screen.scss */ /* line 762, ../../sass/screen.scss */
article.promo .explications { article.promo .explications {
display: table; display: table;
} }
/* line 763, ../../sass/screen.scss */ /* line 765, ../../sass/screen.scss */
article.promo .explications:first-child { article.promo .explications:first-child {
direction: rtl; direction: rtl;
} }
/* line 765, ../../sass/screen.scss */ /* line 767, ../../sass/screen.scss */
article.promo .explications:first-child > * { article.promo .explications:first-child > * {
direction: ltr; direction: ltr;
} }
/* line 770, ../../sass/screen.scss */ /* line 772, ../../sass/screen.scss */
article.promo .explications > div { article.promo .explications > div {
display: table-cell; display: table-cell;
vertical-align: middle; vertical-align: middle;
text-align: center; text-align: center;
} }
/* line 775, ../../sass/screen.scss */ /* line 777, ../../sass/screen.scss */
article.promo .explications > div p { article.promo .explications > div p {
margin: 15px 15px; margin: 15px 15px;
} }
/* line 783, ../../sass/screen.scss */ /* line 785, ../../sass/screen.scss */
.faq-toc { .faq-toc {
font-family: "Lato", sans-serif; font-family: "Lato", sans-serif;
display: block; display: block;
max-width: 700px; max-width: 700px;
margin: 0 auto; margin: 0 auto;
} }
/* line 788, ../../sass/screen.scss */ /* line 790, ../../sass/screen.scss */
.faq-toc ul { .faq-toc ul {
margin: 20px; margin: 20px;
} }
/* line 792, ../../sass/screen.scss */ /* line 794, ../../sass/screen.scss */
.faq-toc ul li a { .faq-toc ul li a {
color: #000; color: #000;
display: block; display: block;
padding: 5px; padding: 5px;
} }
/* line 798, ../../sass/screen.scss */ /* line 800, ../../sass/screen.scss */
.faq-toc ul li.toc-h1 { .faq-toc ul li.toc-h1 {
display: none; display: none;
} }
/* line 802, ../../sass/screen.scss */ /* line 804, ../../sass/screen.scss */
.faq-toc ul li.toc-h2 a { .faq-toc ul li.toc-h2 a {
background: #fcc883; background: #fcc883;
} }
/* line 806, ../../sass/screen.scss */ /* line 808, ../../sass/screen.scss */
.faq-toc ul li.toc-h3 a { .faq-toc ul li.toc-h3 a {
padding-left: 10px; padding-left: 10px;
background: #fff; background: #fff;
font-weight: normal; font-weight: normal;
} }
/* line 812, ../../sass/screen.scss */ /* line 814, ../../sass/screen.scss */
.faq-toc ul li a:hover { .faq-toc ul li a:hover {
color: #395214; color: #395214;
background: #bce085 !important; background: #bce085 !important;
} }
/* line 821, ../../sass/screen.scss */ /* line 823, ../../sass/screen.scss */
.faq article { .faq article {
background: #fff; background: #fff;
padding: 15px; padding: 15px;
} }
/* line 824, ../../sass/screen.scss */ /* line 826, ../../sass/screen.scss */
.faq article h2 { .faq article h2 {
background-color: #fcc883; background-color: #fcc883;
color: #ae6505; color: #ae6505;
margin: -15px; margin: -15px;
padding: 15px; padding: 15px;
} }
/* line 831, ../../sass/screen.scss */ /* line 833, ../../sass/screen.scss */
.faq article h3 { .faq article h3 {
color: #0f4c82; color: #0f4c82;
background-color: #9dcbf3; background-color: #9dcbf3;
@ -1185,19 +1186,19 @@ article.promo .explications > div p {
margin-top: 30px; margin-top: 30px;
padding: 10px 15px; padding: 10px 15px;
} }
/* line 838, ../../sass/screen.scss */ /* line 840, ../../sass/screen.scss */
.faq article h3:nth-child(2) { .faq article h3:nth-child(2) {
margin-top: 0; margin-top: 0;
} }
/* line 843, ../../sass/screen.scss */ /* line 845, ../../sass/screen.scss */
.faq article ul { .faq article ul {
padding-left: 20px; padding-left: 20px;
} }
/* line 845, ../../sass/screen.scss */ /* line 847, ../../sass/screen.scss */
.faq article ul li { .faq article ul li {
list-style: initial; list-style: initial;
} }
/* line 850, ../../sass/screen.scss */ /* line 852, ../../sass/screen.scss */
.faq article p, .faq article ul { .faq article p, .faq article ul {
font-family: "Lato", sans-serif; font-family: "Lato", sans-serif;
font-size: 18px; font-size: 18px;
@ -1206,20 +1207,20 @@ article.promo .explications > div p {
margin-right: 5%; margin-right: 5%;
} }
/* line 864, ../../sass/screen.scss */ /* line 866, ../../sass/screen.scss */
table.stats { table.stats {
width: 100%; width: 100%;
background: #fff; background: #fff;
margin: 20px 0; margin: 20px 0;
cellspacing: 1px; cellspacing: 1px;
} }
/* line 869, ../../sass/screen.scss */ /* line 871, ../../sass/screen.scss */
table.stats th { table.stats th {
font-weight: bold; font-weight: bold;
border-top: 1px solid #000; border-top: 1px solid #000;
border-bottom: 1px solid #999; border-bottom: 1px solid #999;
} }
/* line 874, ../../sass/screen.scss */ /* line 876, ../../sass/screen.scss */
table.stats td, table.stats th { table.stats td, table.stats th {
padding: 5px 3px; padding: 5px 3px;
text-align: center; text-align: center;

View file

@ -16,6 +16,7 @@
<link rel="stylesheet" type="text/css" href="{% static "css/MarkerCluster.Default.css" %}" /> <link rel="stylesheet" type="text/css" href="{% static "css/MarkerCluster.Default.css" %}" />
<script type="text/javascript" src="{% static "js/selectize.min.js" %}"></script> <script type="text/javascript" src="{% static "js/selectize.min.js" %}"></script>
<link rel="stylesheet" type="text/css" href="{% static "css/selectize.css" %}" /> <link rel="stylesheet" type="text/css" href="{% static "css/selectize.css" %}" />
<link href="{% static "jquery-autosuggest/css/autoSuggest-upshot.css" %}" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="{% static "js/editstage.js" %}"></script> <script type="text/javascript" src="{% static "js/editstage.js" %}"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
@ -23,7 +24,10 @@
"{{ STATIC_URL|escapejs }}", "{{ STATIC_URL|escapejs }}",
"{% url 'avisstage:api_dispatch_list' resource_name="lieu" api_name="v1" %}"); "{% url 'avisstage:api_dispatch_list' resource_name="lieu" api_name="v1" %}");
}); });
var django = {};
django.jQuery = $;
</script> </script>
<script type="text/javascript" src="{% static "jquery-autosuggest/js/jquery.autoSuggest.minified.js" %}"> </script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View file

@ -18,8 +18,6 @@ def feedback_widget():
@register.filter @register.filter
def typonazisme(value): def typonazisme(value):
#print value
#return value
value = re.sub(r'(\w)\s*([?!:])', u'\\1\\2', value) value = re.sub(r'(\w)\s*([?!:])', u'\\1\\2', value)
value = re.sub(r'(\w)\s*([,.])', u'\\1\\2', value) value = re.sub(r'(\w)\s*([,.])', u'\\1\\2', value)
value = re.sub(r'([?!:,.])(\w)', u'\\1 \\2', value) value = re.sub(r'([?!:,.])(\w)', u'\\1 \\2', value)

View file

@ -1,4 +1,6 @@
# coding: utf-8 # coding: utf-8
from functools import reduce
def choices_length (choices): def choices_length (choices):
return reduce (lambda m, choice: max (m, len (choice[0])), choices, 0) return reduce (lambda m, choice: max (m, len (choice[0])), choices, 0)

View file

@ -130,7 +130,7 @@ def manage_stage(request, pk=None):
avis_stage_form.instance.stage = stage avis_stage_form.instance.stage = stage
avis_stage_form.save() avis_stage_form.save()
avis_lieu_formset.save() avis_lieu_formset.save()
print request.POST print(request.POST)
if "continuer" in request.POST: if "continuer" in request.POST:
if pk is None: if pk is None:
return redirect(reverse('avisstage:stage_edit',kwargs={'pk':stage.id})) return redirect(reverse('avisstage:stage_edit',kwargs={'pk':stage.id}))
@ -158,7 +158,7 @@ def save_lieu(request):
if request.method == "POST": if request.method == "POST":
pk = request.POST.get("id", None) pk = request.POST.get("id", None)
print request.POST print(request.POST)
jitter = False jitter = False
if pk is None or pk == '': if pk is None or pk == '':
lieu = Lieu() lieu = Lieu()

View file

@ -64,7 +64,7 @@ def cherche(**kwargs):
# Champ générique : recherche dans tous les champs # Champ générique : recherche dans tous les champs
if field_relevant("generique"): if field_relevant("generique"):
#print "Filtre generique", kwargs['generique'] #print("Filtre generique", kwargs['generique'])
dsl = dsl.query( dsl = dsl.query(
"match", "match",
_all={"query": kwargs["generique"], _all={"query": kwargs["generique"],
@ -117,7 +117,7 @@ def cherche(**kwargs):
if use_dsl: if use_dsl:
filtres &= Q(id__in=[s.meta.id for s in dsl.scan()]) filtres &= Q(id__in=[s.meta.id for s in dsl.scan()])
#print filtres #print(filtres)
resultat = Stage.objects.filter(filtres) resultat = Stage.objects.filter(filtres)
tri = 'pertinence' tri = 'pertinence'
@ -178,7 +178,8 @@ def recherche_resultats(request):
stageids = [] stageids = []
if cached is None: if cached is None:
stages = stages[stageids.start_index()-1:stageids.end_index()] stages = stages[max(0, stageids.start_index()-1):
stageids.end_index()]
else: else:
stages = Stage.objects.filter(id__in=stageids) stages = Stage.objects.filter(id__in=stageids)

View file

@ -1,6 +1,6 @@
from settings_base import * from .settings_base import *
from secrets import SECRET_KEY from .secrets import SECRET_KEY
DEBUG = True DEBUG = True

View file

@ -1,6 +1,6 @@
from settings_base import * from .settings_base import *
from secrets import SECRET_KEY from .secrets import SECRET_KEY
import os, sys import os, sys
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy

View file

@ -1,2 +1,3 @@
-r requirements.txt
#spatialite-bin #spatialite-bin
django-debug-toolbar django-debug-toolbar

View file

@ -1 +1,2 @@
psycopg2 -r requirements.txt
psycopg2-binary==2.7.*

View file

@ -1,11 +1,11 @@
django django==1.11.*
django-cas-ng django-cas-ng==3.5.*
django-taggit django-taggit==0.22.*
python-ldap python-ldap==3.0.*
django-tinymce django-tinymce==2.7.*
django-braces django-braces==1.12.*
django-taggit-autosuggest django-taggit-autosuggest==0.3.*
pytz pytz==2018.*
django-tastypie django-tastypie==0.14.*
lxml lxml==4.2.*
git+https://github.com/sabricot/django-elasticsearch-dsl django-elasticsearch-dsl==0.4.*