Commit graph

217 commits

Author SHA1 Message Date
Evarin
f105225abf Commentaires dans le code 2019-01-05 18:50:53 +01:00
Basile Clement
c960d97b67 Extrait les petits cours dans une application séparée
L'application `petitscours` reste assez fortement couplée à
`gestioncof`, et n'est pas (encore ?) faite pour être utilisée
séparément.

De façon similaire, et afin de minimiser de potentiels problèmes dûs à
des migrations, les modèles de l'application `petitscours` utilisent
`app_label = "gestioncof"` pour que Django les considère comme faisant
partie de l'application `"gestioncof"`.  Ils pourront être migrés dans
un second temps si cela s'avère nécessaire.

Les changements sont nombreux, mais assez simples: il s'agit
principalement de déplacer des fichiers et changer des imports.  J'ai
également profité de l'occasion pour réorganiser les templates afin de
les placer dans l'espace de nom "petitscours/".

cof/
 * settings/common.py: Add `petitscours` app
 * urls.py: Use `petitscours.urls`

petitscours/
 * __init__.py: Added.
 * tests/__init__.py: Added.
 * tests/utils.py: Added.
 * urls.py: Added.

gestioncof/
 * admin.py:
 * management/commands/loaddevdata.py:
 * models.py:
 * signals.py: Typo.
 * urls.py:
       Moved petitscours_patterns to petitscours.urls
 * petits_cours_forms.py:
       Moved to petitscours/forms.py
 * petits_cours_models.py:
       Moved to petitscours/models.py
 * petits_cours_views.py:
       Moved to petitscours/views.py
 * tests/utils.py:
 * tests/test_petitscours_views.py:
       Moved to petitscours/tests/test_petitscours_views.py
 * templates/base_title_petitscours.html:
       Moved to petitscours/templates/petitscours/base_title.html
 * templates/demande-petit-cours.html:
       Moved topetitscours/templates/petitscours/demande.html
 * templates/gestioncof/details_demande_petit_cours.html:
       Moved to petitscours/templates/petitscours/demande_detail.html
 * templates/petits_cours_demandes_list.html:
       Moved to petitscours/templates/petitscours/demande_list.html
 * templates/demande-petit-cours-raw.html:
       Moved to petitscours/templates/petitscours/demande_raw.html
 * templates/details_demande_petit_cours_infos.html:
       Moved to petitscours/templates/petitscours/details_demande_infos.html
 * templates/inscription-petit-cours.html:
       Moved to petitscours/templates/petitscours/inscription.html
 * templates/inscription-petit-cours-formset.html:
       Moved to petitscours/templates/petitscours/inscription_formset.html
 * templates/gestioncof/traitement_demande_petit_cours.html:
       Moved to petitscours/templates/petitscours/traitement_demande.html
 * templates/gestioncof/traitement_demande_petit_cours_autre_niveau.html:
       Moved to petitscours/templates/petitscours/traitement_demande_autre_niveau.html
 * templates/gestioncof/traitement_demande_petit_cours_success.html:
       Moved to petitscours/templates/petitscours/traitement_demande_success.html
2018-11-25 13:25:16 +01:00
Martin Pépin
712588af7d Merge branch 'master' into evarin/site-cof 2018-11-19 23:30:33 +01:00
Basile Clement
00a1e79af6 Fix CAS support in python-cas 1.3+
cas.eleves.ens.fr has /serviceValidate, not /p3/serviceValidate, and is
thus *probably* a V2 CAS server.  python-cas was broken and using
/serviceValidate for V3 while it should have been /p3/serviceValidate,
see
c3ac4b6c76
2018-11-12 00:54:44 +01:00
Evarin
1e3850bb6b Nettoyage dates et calendrier 2018-10-14 15:50:55 +02:00
Aurélien Delobelle
fdd2b35289 core -- Apply black + isort to all files 2018-10-06 13:15:33 +02:00
Martin Pépin
68e71317cb Hotfix: broken urls for mailing lists 2018-06-01 17:08:24 +02:00
Aurélien Delobelle
ece9a54df3 Upgrade to reCAPTCHA v2
reCAPTCHA v1 has been shut down since March 2018.

We now uses reCAPTCHA v2:
- user must check a simple checkbox (No CAPTCHA),
- eventually he must validate a challenge.

Moving keys settings allows to use the captcha for development.

Fixes #192.
2018-05-14 13:22:59 +02:00
Evarin
6d72644ee3 Clean code up 2018-04-28 15:59:49 +02:00
Martin Pépin
e21666a112 Fix old-style urls (registration) 2018-04-16 16:34:34 +02:00
Martin Pépin
a73736bf41 Merge branch 'master' into Kerl/drop_py2_compat 2018-04-16 14:12:36 +02:00
Martin Pépin
a7cd1e04cd prefer CORS_ORIGIN_WHITELIST to CORS_ORIGIN_REGEX_WHITELIST 2018-04-08 22:33:19 +02:00
Martin Pépin
556c354f8a Merge branch 'master' into Roussille/bda 2018-04-08 22:30:48 +02:00
Martin Pépin
71a61fe31d Merge branch 'master' into aureplop/cof-tests_misc 2018-04-07 12:41:42 +02:00
Evarin
347497602c Revert urls prefixing 2018-02-20 17:21:26 +01:00
Martin Pepin
d88ce44989 Merge branch 'aureplop/fix-autocomplete-js' into 'master'
Fix autocomplete in registration views.

See merge request cof-geek/gestioCOF!288
2018-02-05 22:49:18 +01:00
Evarin
59116f2d46 International wagtail urls 2018-02-03 22:34:37 +01:00
Aurélien Delobelle
f8361b9114 Add & fix urls naming 2018-01-22 21:59:41 +01:00
Evarin
8551ffcfd3 Merge branch 'master' into evarin/site-cof 2018-01-20 19:37:12 +01:00
Aurélien Delobelle
4084444dc3 Fix autocomplete in registration views.
django-autocomplete-light v3.x doesn't include anymore the
$('').yourlabsAutocomplete() function, leading to issues in cof
registration and kfet account creation views.

Adding jquery-autocomplete-light fixes these issues.

See:
- (dal) https://github.com/yourlabs/django-autocomplete-light
- (jal) https://github.com/yourlabs/jquery-autocomplete-light
2018-01-20 17:29:15 +01:00
Aurélien Delobelle
6059ca067b Speed up tests
~20% less using MD5 and force_login in kfet testcase.
~77% less by disabling the debug tollbar.
2018-01-15 05:41:51 +01:00
Martin Pépin
5a5b60ec4d Merge branch 'master' into Kerl/drop_py2_compat 2018-01-10 20:12:59 +01:00
Martin Pépin
57411ab46f Remove __future__ imports 2018-01-06 16:10:13 +01:00
Martin Pépin
475f1adec5 Remove "coding: utf8" line 2018-01-06 16:10:13 +01:00
Aurélien Delobelle
b0b0542407 Upgrade to Django 1.11
- Deprecation warnings using Django 1.8 are resolved.
- Deprecation warnings using Django 1.11 are resolved.

- Admin: grappelli is no longer used.
- Upgrade to django-autocomplete-light v3 (v2 is not 1.11 compatible).
  * autocomplete.modelform_factory being dropped, code uses dal Select2
    views and widgets.
2017-11-19 18:41:39 +01:00
Martin Pépin
1c90d067fa Make cof.settings a module 2017-10-26 18:13:09 +02:00
Martin Pépin
40abe27e81 EMAIL_HOST needs to be set but as a secret 2017-10-25 22:05:14 +02:00
Martin Pépin
b9aaea0f99 Merge branch 'master' into Production 2017-10-16 14:26:05 +02:00
Martin Pépin
b73faa3b84 Merge branch 'master' into Production 2017-09-25 18:40:00 +02:00
Aurélien Delobelle
b42452080f Mass cleaning of kfet' authentication machinery
AccountBackend
- Should now work if used in AUTHENTICATION_BACKENDS settings.
- It does not retieve itself the password, as it should not be used
this way.

GenericBackend
- Delete useless 'username' arg of its 'authenticate()' method.
- Now delete the token in DB.

TemporaryAuthMiddleware
- New name of the middleware is more meaningful.
- Is now responsible to retrieve the password from the request, instead
of the AccountBackend.

GenericTeamToken model
- Add a manager' method to create token, avoiding possible error due to
unicity constraint.

GenericLoginView (authentication with the kfet generic user)
- Replace obscure system with a 100% HTTP handling.
- See comments for more information.

Misc
- More docstrings!
- More tests!
- Add some i18n.
- Add kfet/confirm_form.html template:
    Ask user to confirm sth via a form (which will send a POST request).
    Context variables:
        * title: the page title
        * confirm_url: action attribute for <form>
        * text: displayed confirmation text
- kfet.js : Add functions allowing to emit POST request from <a> tag.
- Non-link nav items from kfet navbar also get a 'title'.
- A utility has been found for the 'sunglasses' glyphicon!
2017-09-25 17:57:47 +02:00
Martin Pépin
4091185a68 import LDAP_SERVER_URL in settings 2017-09-20 18:19:15 +02:00
Aurélien Delobelle
bf61e41b50 Move auth-related from 'kfet' app to 'kfet.auth'. 2017-09-19 17:05:51 +02:00
Hugo Roussille
a4eedbc1a6 Whitelist bda and cof apps for cross-domain 2017-09-13 18:21:34 +02:00
Hugo Roussille
4bd2562edf django-cors-headers for cross-domain AJAX 2017-09-13 15:57:57 +02:00
Martin Pépin
1921f05eba Move STATIC_ROOT in production 2017-09-12 09:22:54 +02:00
Martin Pépin
2a519bfedf Add SCRIPT_NAME to the production-like server 2017-08-13 14:36:45 +01:00
Martin Pépin
4c08962e09 Hide more stuff in secret.py 2017-08-13 13:39:13 +01:00
Martin Pépin
5923166196 Specify the full path of the sqlite database 2017-08-11 17:24:09 +01:00
Martin Pépin
ad15c45237 Switch to nginx + postgres in vagrant 2017-08-09 22:18:26 +01:00
Martin Pépin
cb1d253517 Local development settings
- Add a new settings file for local development
- Update README.md according to the new setup
2017-08-09 22:17:27 +01:00
Martin Pépin
a6b0c51d39 Add SERVER_EMAIL to the secrets 2017-08-08 00:25:13 +01:00
Martin Pépin
81f3d6ab81 Move STATIC_ROOT in production 2017-08-08 00:24:00 +01:00
Martin Pépin
88597e62f1 More verbose secret error reporting 2017-08-08 00:06:03 +01:00
Evarin
65d7a66eb8 Début nouveau site cof 2017-08-07 23:31:27 +02:00
Aurélien Delobelle
455b730cc3 Merge branch 'master' into aureplop/kfet_cms 2017-06-23 02:53:05 +02:00
Aurélien Delobelle
19847ac9d8 add token check to raw_open edit view 2017-06-22 15:48:45 +02:00
Aurélien Delobelle
b8110c11a4 kfet.open
kfet.open app
- Base data (raw_open, last_update...) is stored and shared through cache system.
- 2 websockets groups: one for team users, one for other users.
- UI is initialized and kept up-to-date with WS.
- raw_open and force_close can be updated with standard HTTP requests.
  At this time, there isn't any restriction on raw_open view. Common sense tell us
  to change this behavior.

Misc
- Clean channels routing.
- 'PermConsumerMixin': user who sent the message is available as argument in
connection_groups method, which returns groups to which the user should be
appended on websocket connection (and discarded on disconnection).
- New kfet.utils module: should be used for mixins, whatever is useful and not concerns
the kfet app.
- Clean JS dependencies.
2017-06-21 07:08:28 +02:00
Aurélien Delobelle
2381af92e3 Merge branch 'master' into aureplop/kfet_open 2017-06-21 05:47:53 +02:00
Martin Pepin
539c32dbbe Merge branch 'aureplop/fix_cache' into 'master'
Configure un système de cache

See merge request !221
2017-06-20 15:53:29 +02:00
Aurélien Delobelle
ec59bc2edc Merge branch 'master' into aureplop/kfet_open 2017-06-12 15:18:42 +02:00
Aurélien Delobelle
d004287957 Merge branch 'master' into aureplop/kfet_cms 2017-06-12 02:04:28 +02:00
Aurélien Delobelle
8c6d56b27c Add Wagtail CMS for kfet app.
K-Fêt
- Integrate wagtail to serve "static" pages of old K-Fêt website
- Fixture "kfetcms/kfet_wagtail_17_05" contains a copy of old website
(as in May 2017).
- Media files can be got until end of June 17 at
http://partage.eleves.ens.fr//files/604e6dea2ceebc66b1936c6b3f911744/kfet_media.tar.gz

Login/logout
- Update package django_cas_ng to last version.
- Clean COFCASBackend.
- Change CAS version to 3 (version used on eleves.ens). This enables
the logout redirection (for CAS ofc).
- Add messages and clean existing ones on login/logout (for both
outsider and cas users).

Misc
- Update settings to bypass an incompability between debug-toolbar and
wagtailmenus packages.
- Better management of dev/test-specific urls (if debug-toolbar wasn't in
INSTALLED_APPS, media files were not served).
- UI improvements.
2017-05-30 20:44:30 +02:00
Martin Pépin
ea21b07657 Add an announcement banner 2017-05-25 23:58:59 +01:00
Martin Pepin
5d8427e601 Merge branch 'aureplop/fewer_requests' into 'master'
Moins de requêtes

See merge request !217
2017-05-12 21:13:35 +02:00
Aurélien Delobelle
e7266e7a9d use new settings for redis 2017-04-26 11:28:18 +02:00
Aurélien Delobelle
673dc0295d Merge branch 'master' into aureplop/fix_cache 2017-04-26 11:22:29 +02:00
Martin Pépin
dbff7740c8 Add REDIS_PORT to the settings and secrets 2017-04-25 20:23:21 +01:00
Martin Pépin
2aee43e01a Add more configuration options for redis
- `REDIS_HOST` can be specified in the secrets
- Two new secrets: `REDIS_PASSWD` and `REDIS_DB`
2017-04-24 22:17:41 +01:00
Aurélien Delobelle
2eee8f58aa Merge branch 'master' into aureplop/fewer_requests 2017-04-17 20:45:01 +02:00
Aurélien Delobelle
8622002e8d minor change 2017-04-17 20:40:54 +02:00
Aurélien Delobelle
dbf5844f6a Clean settings redis 2017-04-15 14:41:55 +02:00
Aurélien Delobelle
e772d12721 Merge branch 'master' into aureplop/fix_cache 2017-04-15 14:27:20 +02:00
Martin Pépin
ff73a635f8 Minor fixes in settings/
- Typo
- Removes old comments
- Moves the template debug context processor back to the common file: it
  won't be loaded anyway if `DEBUG=False`.
- Ddt's middleware should be loaded first
2017-04-15 11:09:16 +01:00
Aurélien Delobelle
b5cc26bb1b Merge branch 'master' into aureplop/fewer_requests 2017-04-11 22:46:18 +02:00
Martin Pépin
a5fb162aaf New organisation of settings files
We reproduce what has been done here:
https://github.com/dissemin/dissemin

The following files can be found under `cof/settings/`
- `common.py`: the settings that are shared by all the environments we
  have + the secrets (see below).
- `dev.py`: the settings used by the vagrant VM for local development.
- `prod.py`: the production settings (for both www.cof.ens.fr and
  dev.cof.ens.fr)

There is also a notion of "secrets". Some settings like the `SECRET_KEY`
or the database's credentials are loaded from an untracked files called
`secret.py` in the same directory. This secrets are loaded by the common
settings file.
2017-04-10 23:01:19 +01:00
Aurélien Delobelle
2a3c892d39 Merge branch 'master' into aureplop/fix_cache 2017-04-10 21:39:54 +02:00
Aurélien Delobelle
36771c2c4f Use redis for cache.
- Cache use db #1 of redis.
- Channel layer (of channels) use db #0 of redis.
- `settings` try getting redis connection variables from environment.
- Drop memcached system
2017-04-10 21:36:00 +02:00
Aurélien Delobelle
ab31c20649 missing CACHES value... 2017-04-10 19:47:00 +02:00
Aurélien Delobelle
784ba9bd10 Merge branch 'master' into aureplop/kfet_config 2017-04-08 18:36:28 +02:00
Aurélien Delobelle
c9019c4eb4 Get debug toolbar with ajax calls
- Add django-debug-panel module to pip development dependencies
- Enable debug toolbar on ajax calls by using the "Django Debug Panel"
  extension for... Chrome.

For further informations about:
- django module, see https://github.com/recamshak/django-debug-panel
- Chrome extension, see https://github.com/recamshak/chrome-django-panel
2017-04-06 14:36:25 +02:00
Qwann
a5671fdf4c Merge branch 'master' into qwann/k-fet/kfet_open 2017-04-05 17:40:19 +02:00
Martin Pépin
f13d1072c7 Add simple tests for the stat views
We check that we can get all the stats views with the appropriate
permissions.
2017-04-03 23:21:42 +01:00
Aurélien Delobelle
85caa6b058 Use django-djconfig for kfet app.
Old configuration(/settings), based on Settings model, system is
deleted: SettingsForm, Settings.
New system use `django-djconfig` module.

- `kfet.config` module provides `kfet_config` to access configuration concerning
kfet app.
- Views, forms, models, etc now use this object to retrieve conf values.
- Views no longer add config values to context, instead templates use
  `kfet_config` provided by a new context_processor.
- Enhance list and update views of settings.
- Fix: settings can directly be used without having to visit a specific
  page...

Misc
- Delete some py2/3 imports
- Delete unused imports in kfet.models and kfet.views
- Some PEP8 compliance
2017-04-03 20:32:16 +02:00
Martin Pépin
6e55905781 Merge branch 'master' into Kerl/use_django_custommail 2017-02-11 03:20:29 +01:00
Qwann
f87f1ceff1 kfetOpen bullet working 2017-02-11 00:29:12 +01:00
Martin Pépin
993b8ae87b Merge branch 'master' into Kerl/use_django_custommail 2017-01-13 01:02:01 +01:00
Martin Pépin
540b6f38b8 Merge branch 'master' into Kerl/ldap 2017-01-09 15:47:12 +01:00
Aurélien Delobelle
792c4177ec Merge branch 'master' into k-fet 2017-01-07 00:38:54 +01:00
Martin Pépin
ab80db8bed Merge branch 'master' into Kerl/clean_staticfiles 2016-12-26 00:54:31 +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
Martin Pépin
fe8f18ff78 Utilise django_custommail
- On installe le package depuis le dépôt COF-Geek
- On supprime tous les fichiers texte des mails
- On charge dans la bdd les mails nécessaires au fonctionnement de
  GestioCOF
- On supprime le modèle CustomMail obsolète de gestioncof
2016-12-22 03:45:03 +01:00
Aurélien Delobelle
f5ebe3f166 Merge branch 'master' into k-fet 2016-12-03 21:44:33 +01:00
Martin Pepin
2196c7dce1 Merge branch 'Kerl/venv' into 'master'
Virtualenv

Ce patch introduit un virtualenv dans le setup de dev. Cela permet notamment de passer à python 3 sans 
avoir à remplacer toutes ses commandes `python manage.py ...` par `python3 manage.py ...`. 

Il faut relancer le provisionning de la VM pour appliquer ce patch : `vagrant reload --provision`

See merge request !109
2016-11-21 01:28:26 +01:00
Martin Pépin
5a2fc9d1e5 Cesse d'utiliser des fichiers statiques custom 2016-11-20 20:09:12 +01:00
Martin Pépin
9a9ff69f55 Ajoute le jour en toutes lettres dans les dates 2016-11-20 18:42:59 +01:00
Martin Pepin
d6dd7b346c Merge branch 'Elarnon/mail_bda' into 'master'
Améliore les mails automatiques du BdA

Les mails du BdA sont maintenant tous chargés depuis des templates gérés par le système de templates de Django, et plus par de l'interpolation de chaîne de caractères. Ceci permet en particulier d'utiliser (et de configurer) la localisation de Django afin d'afficher les dates de façon uniforme (et sans "hack" à la `date_no_seconds`) dans un format comportant un "à" entre le jour et l'heure.

See merge request !113
2016-11-20 16:53:29 +01:00
Martin Pépin
debc10213e Typo + docstrings inutiles 2016-11-20 16:52:07 +01:00
Martin Pépin
f93b095e0f Styling
Ou comment faire plaisir à pylint sur les bouts de code concernés
par cette MR
2016-11-20 16:39:26 +01:00
Martin Pépin
6de2fa307b Merge branch 'master' into Kerl/venv 2016-11-18 01:09:39 +01:00
Martin Pepin
297164aae0 Merge branch 'Elarnon/ci' into 'master'
Lance les tests de gestioCOF sur gitlab-ci



See merge request !116
2016-11-14 06:41:27 +01:00
Basile Clement
a5ee17d0b5 Lance les tests de gestioCOF sur gitlab-ci 2016-11-13 15:16:57 +01:00
Basile Clement
567c9a0a6d Meilleur affichage des dates
Configure la localisation (i10n) de Django afin d’afficher un format
plus user-friendly par défaut pour les dates (par exemple, afficher
"21 septembre 2016 à 15:00" plutôt que "21 septembre 2016
15:00"). Ceci permet d’éliminer les utilisations de `date_no_seconds`
pour simplement les remplacer par l’affichage de la date, le format
par défaut étant maintenant satisfaisant.

Attention : le bon fonctionnement de ceci nécessite de changer les
settings afin d’utiliser le module `cof.locale` comme module de
localisation (définir `FORMAT_MODULE_PATH = "cof.locale"`). Le module
`cof.locale` définit le format d’affichage des dates+heures
(`DATETIME_FORMAT`) afin d’incorporer le "à" qui n'est pas présent
dans la localisation française de Django.
2016-11-12 11:00:18 +01:00
Basile Clement
a63f1da2e1 Mise à jour de django_debug_toolbar 2016-11-06 19:48:11 +01:00
Basile Clement
d77a4dde3e GestioCOF devrait fonctionner sur / aussi bien que sur /gestion 2016-11-06 19:47:31 +01:00
Martin Pépin
0cca9f0861 Mise à jour de django_debug_toolbar 2016-11-06 15:39:14 +01:00
Martin Pépin
b40fc6204f Changements mineurs
- Suppression de la variable `ALLOWED_HOSTS` de `cof/settings.dev` de
sorte quand django utilise le default (qui est adapté à notre usage)
- Correction d'indentation
- Suppression d'un "-e" dans le fichier `requirements.txt`
2016-11-05 22:01:38 +01:00
Martin Pépin
1a6b86703a Merge branch 'master' into Kerl/settings_syntax 2016-10-03 01:58:55 +02:00
Aurélien Delobelle
d559549c06 Fix oubli auth backend kfet_genericteam user dans settings_dev 2016-09-29 23:17:42 +02:00
Martin Pépin
7abdccfbdb Meilleure gestion des données mails
Les valeurs de champs FROM, REPLY-TO et BCC des mails envoyés par
GestioCOF sont enregistrées dans un dictionnaire `settings.MAIL_DATA`
plutôt que d'être toutes enregistrées comme variables indépendantes
2016-09-27 17:57:53 +02:00
Ludovic Stephan
103b2880f7 BdA 2016-09-27 16:57:39 +02:00