Commit graph

31 commits

Author SHA1 Message Date
Basile Clement
f59e868793 Ajoute get_queryset dans ModelSearch
Quand on utilise les vues d'auto-complétion, on a la possibilité de
configurer des filtres avec `get_queryset_filter`, mais pas d'autres
transformations sur le queryset.  Notamment, cela signifie que pour les
vues qui utilisent des `ForeignKey`, on ne peut pas spécifier de
`select_related` pour éviter des requêtes inutiles et répétées lors du
rendering des vues.

Ce patch ajoute une méthode `get_queryset`, en suivant la convention
habituelle de Django, permettant cette configuration, et l'utilise pour
appeler `select_related` de façon appropriée dans les vues qui en
bénéficient.

À priori, cela devrait permettre de compenser la potentielle perte de
performance de !469, qui a supprimé les `select_related` lors de la
sélection des participants.
2020-10-23 22:37:03 +02:00
Martin Pépin
9ac030fd16
Instantiate the Compose classes in their own file 2020-07-18 16:07:12 +02:00
Martin Pépin
e7517195cd
Generic autocompletion view 2020-07-18 16:07:12 +02:00
Martin Pépin
9a90f19502
Separate the autocompletion logic form the views 2020-07-05 11:15:50 +02:00
Martin Pépin
c7ca96bce5
Autocompletion: new de-duplication mechanism 2020-07-04 13:06:24 +02:00
Martin Pépin
c5adc6b7d8
Use the new shared autocomplete framework in kfet/ 2020-06-20 19:28:48 +02:00
Martin Pépin
481cb5e478
Move production deps out of requirements.txt 2019-11-22 22:18:04 +08:00
Aurélien Delobelle
fdd2b35289 core -- Apply black + isort to all files 2018-10-06 13:15:33 +02:00
Martin Pépin
475f1adec5 Remove "coding: utf8" line 2018-01-06 16:10:13 +01:00
Aurélien Delobelle
1cc51f17a3 Prevent connection to LDAP when settings is None 2017-10-24 17:55:02 +02:00
Aurélien Delobelle
b4338ce8db View 'search account' should be restricted. 2017-08-16 22:54:40 +02:00
Martin Pépin
a793e9a2e7 exclude empty strings from ldap results
The uid attribute in a LDAP's entry cannot be an empty string. We need
to get an actual identifier.
2017-04-01 22:07:32 +01:00
Martin Pépin
9cdf064005 Handle incomplete values from the LDAP
Sometime `uid` is not set in the objects fetched from the LDAP. This
case has to be handled. Also, the `.uid` and `.cn` attributes of these
objects in the python abstractions have a `.value` method which we
should use.
2017-04-01 21:45:05 +01:00
Aurélien Delobelle
cb13280458 Merge branch 'master' into 'Aufinal/merge_k-fet'
# Conflicts:
#   kfet/static/kfet/css/index.css
2017-03-24 20:23:32 +01:00
Martin Pépin
0aed975615 Fix the empty-query test in autocomplete
If there is no valid word to search in the LDAP database, no query is
performed. Since 74f0b63e, that behaviour was broken because of a typo
2017-03-20 08:14:20 +00:00
Martin Pépin
74f0b63e96 Change ldap query behaviour if multiple inputs
It is now consistent with the other lookups over the User database
2017-03-19 15:10:08 +00:00
Martin Pépin
4899bba1f7 Replace list comprehensions by iterators in dal 2017-03-19 14:05:25 +00:00
Martin Pépin
741f0183e6 Prevent ldap injections in autocompletion views
We only allow alphanumeric characters in the query in order to avoid
injections
2017-03-16 22:43:43 +00:00
Ludovic Stephan
3793863bab Merge remote-tracking branch 'origin/k-fet' into Aufinal/merge_k-fet 2017-03-15 22:58:54 -03:00
Martin Pépin
e98a407982 Rename bits -> search_words in kfet.autocomplete
This is typo, this variable has not the same name in
`gestioncof.autocomplete` and `kfet.autocomplete`
2017-03-15 19:02:31 +00:00
Martin Pépin
02a8e74e3b Optimize code, better queries
- Remove useless Q queries
- Optimize with sets
- Queries over clipper id too
2017-02-11 02:39:59 +01:00
Ludovic Stephan
1b0144691f No need for len of query 2017-01-20 07:32:11 -02:00
Ludovic Stephan
e7956f3b62 Account search w/ autocomplete 2017-01-19 12:36:40 -02:00
Ludovic Stephan
88aec52141 PEP8 + typo 2017-01-19 01:22:04 -02:00
Martin Pépin
01ce955784 Fixes
- Fixes bugs
- Removes useless scripts
2016-12-25 12:27:42 +01:00
Martin Pépin
3c7558c853 The end of Clipper
GestioCOF fetches the clipper accounts from an LDAP database and doesn't
need to store clippers in a table anymore.
2016-12-25 11:57:50 +01:00
Aurélien Delobelle
efd92e9967 Fix protection autocomplete 2016-09-24 19:31:50 +02:00
Aurélien Delobelle
ba0a5d0d27 Py2 compatible 2016-09-01 00:45:44 +02:00
Aurélien Delobelle
39af9afd5b moins de print qui se baladent 2016-08-15 12:15:11 +02:00
Aurélien Delobelle
b8fe555741 Gestion très primaire des utilisateurs 2016-08-03 04:57:28 +02:00
Aurélien Delobelle
43d938edd0 initial 2016-08-02 10:40:46 +02:00