Commit graph

1593 commits

Author SHA1 Message Date
Martin Pépin
40abe81402 Integrate the new settings workflow into vagrant 2017-04-10 23:01:19 +01: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
Martin Pepin
a68002d0f6 Merge branch 'aureplop/fix_double_js' into 'master'
Fix stats on some browsers

See merge request !219
2017-04-10 23:59:02 +02: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
Martin Pepin
495c6ac3d1 Merge branch 'aureplop/kfet_config' into 'master'
Configuration utilisateur K-Fêt

See merge request !210
2017-04-10 21:14:37 +02:00
Aurélien Delobelle
ab31c20649 missing CACHES value... 2017-04-10 19:47:00 +02:00
Aurélien Delobelle
2c40838938 Add real cache support
- Fix cache per process issue with a real cache system
- Configuration seems too easy... but it seems to work
2017-04-10 19:47:00 +02:00
Qwann
be8d249ed7 remove useless code 2017-04-10 17:47:39 +02:00
Qwann
e0b0a53112 stupidness removed 2017-04-10 17:18:43 +02:00
Qwann
cb9ba76a4f small fixes 2017-04-10 16:47:13 +02:00
Aurélien Delobelle
5d6012b6bd Fix kfet tests
- and add test for `kfet_config.subvention_cof`
2017-04-10 11:52:57 +02:00
Aurélien Delobelle
c228416809 Subvention -> Réduction + units for kfet_config
- kfet_config gives "reduction_cof" as editable instead of
  "subvention_cof"
- this last one can still be accessed via kfet_config (computed from
  new "reduction_cof"
- add units to numeric values of kfet_config form
2017-04-10 11:36:06 +02:00
Qwann
5c6a73c597 kfet_open uses moment.js 2017-04-09 20:54:30 +02:00
Qwann
15873085e1 small fixes 2017-04-09 20:01:52 +02:00
Aurélien Delobelle
6ce2f178bf Fewer requests on petit cours details management. 2017-04-09 17:57:11 +02:00
Aurélien Delobelle
3dc91e30bd Fewer requests on petit cours list management. 2017-04-09 17:51:40 +02:00
Aurélien Delobelle
8870b5ace2 Fewer queries on poll view 2017-04-09 17:37:15 +02:00
Aurélien Delobelle
029d59e615 Enable authentication on KPsul websocket.
- PermConsumerMixin allows checking permissions on connection to a
  consumer.
- KPsul consumer uses this mixin to check if connecting user has the
  permission `kfet.is_team`.

Fixes #67.
2017-04-09 16:10:27 +02:00
Aurélien Delobelle
1e18c4043e Use last channels & co versions
- Use last official releases of channels, asgiref, daphne and
  asgi-redis packages.
- Customization of JsonWebsocketConsumer is now in kfet app through a
  custom class (and so, doesn't require anymore a forked version of channels).
- Clean kfet consumers code.
2017-04-09 15:47:16 +02:00
Aurélien Delobelle
ebfe5c41d4 Fix stats on some browsers
- Delete double import in account_read template
- Syntax on account_read

Stats didn't show on Chrome (at least v57) cause of these.
2017-04-09 01:52:26 +02:00
Aurélien Delobelle
e89ff68d3b add misisng import 2017-04-09 01:39:18 +02:00
Aurélien Delobelle
457ee64004 update migrations order 2017-04-08 18:38:47 +02:00
Aurélien Delobelle
784ba9bd10 Merge branch 'master' into aureplop/kfet_config 2017-04-08 18:36:28 +02:00
Aurélien Delobelle
ce70269e7b Fewer requests on create/update spectaclerevente in bda admin.
- O(#participant) -> O(1) requests
2017-04-08 17:50:36 +02:00
Aurélien Delobelle
0750551d7c Fewer requests on participant admin create and updateviews.
- Fewer requests on choicesreventes and tabular inlines (of
  attributions)
- User and tirage cannot be updated if updating a participant instance.
- Tabular inlines are fixed:
  - the one which is used for spectacles with listing only propose
    choices in spectacle with listing
  - same with the other (spectacles without listing)
- Still does too much request (because of tabularinlines)
2017-04-08 17:16:33 +02:00
Aurélien Delobelle
6451f971bd AttributionForm in bda admin
- New attribution form issue less queries
- Spectacle and Participant are readonly if updating an attribution.

ReadOnlyMixin allows to set readonly fields only while updating an
object.
2017-04-08 16:11:42 +02:00
Aurélien Delobelle
15861824b6 Merge branch 'Aufinal/tabs' into 'master'
K-Fêt
- Détails d'un compte: historique et stats sont accessibles par des onglets.

See merge request !218
2017-04-08 14:41:36 +02:00
Aurélien Delobelle
bbe6f41962 Fewer requests on descriptions and catalogue views 2017-04-08 13:44:21 +02:00
Aurélien Delobelle
98f355ed20 Fewer requests on unpaid view 2017-04-08 13:08:53 +02:00
Aurélien Delobelle
15d2faf8e1 Fewer requests on spectacles and participants list views 2017-04-08 13:01:05 +02:00
Aurélien Delobelle
93a3a9af2c Fewer requests with shotgunable reventes
bda.views.revente_shotgun:
- 2 requests instead of ~#spectacles requests
2017-04-08 12:53:37 +02:00
Aurélien Delobelle
fdc1128bd5 delete useless save 2017-04-08 12:12:56 +02:00
Aurélien Delobelle
3556e3b1b0 Fewer requests on bda.views.revente 2017-04-08 12:10:23 +02:00
Ludovic Stephan
4a6bfd5e3d Better button distinction 2017-04-07 12:58:03 -03:00
Qwann
e18c2c698c new migration 2017-04-07 17:52:44 +02:00
Qwann
deb0d4de1e moving migration again 2017-04-07 17:23:41 +02:00
Ludovic Stephan
052e7b2b6e Move navigation to content-left 2017-04-07 12:17:36 -03:00
Qwann
531a4611d3 Merge branch 'master' into qwann/k-fet/kfet_open 2017-04-07 17:11:48 +02:00
Aurélien Delobelle
d31101aff3 Empty SpectacleRevente and ChoixRevente before do_tirage.
- Usefull if a tirage is launched more than once.
- Ensure full reset of reventes for this tirage in this case.
2017-04-07 17:04:06 +02:00
Aurélien Delobelle
9f307c1bd0 Fewer db requests on bda tirage.
bda.algorithm
- use iterator to find max_groups, instead of a db request

bda.views.do_tirage
- select_related() are now focused on some relationships (they were
  taking useless relationships)
- bda-revente filling takes 1 request (each save and add was issuing
  1 request)
2017-04-07 16:22:10 +02:00
Aurélien Delobelle
3e0bd2e758 Fewer db requests on bda views.
bda.views.etat_places
- Use select_related on spectacles_set,  avoid query issue for each spectacle.
- `slots__sum` is computed in view, instead of a query.
- Cleaner code (and avoid useless computations).

bda.views.places
- Add select_related on places, avoid query issue for each spectacle.

bda.views.inscription
- 1 query for spectacle field choices, instead of (#forms in formset *
  #spectacles)
- Delete BaseBdaFormSet. The validation was redundant with
  `unique_together` of ChoixSpectacle model.
2017-04-07 13:25:50 +02:00
Ludovic Stephan
e26668e5eb Add tabs to account_read 2017-04-06 21:17:47 -03:00
Aurélien Delobelle
b8aa5d8bbe Merge branch 'master' into aureplop/fewer_requests 2017-04-06 21:25:22 +02:00
Aurélien Delobelle
a0979c220b Merge branch 'bda_pep8' into 'master'
Clean the `bda.views.catalogue` view

See merge request !212
2017-04-06 21:24:18 +02:00
Aurélien Delobelle
0ed70eb0a7 PEP8
No improvement.
2017-04-06 20:30:23 +02:00
Aurélien Delobelle
026fba867d Fewer db requests on home view.
- 1 request instead of (2 + #articles)
2017-04-06 19:44:16 +02:00
Aurélien Delobelle
2731d4630f Fewer requests on accounts groups.
- Saves two queries.

(4 prefetch where done, replaced by 2 prefetchs (whose 1 with 2
selected_related))
2017-04-06 19:25:23 +02:00
Aurélien Delobelle
afdb08b424 Fewer db requests with AccountNegative handling.
- AccountNegative use new AccountNegativeManager which select_related
  account, cofprofile and user for instances accessed via
  AccountNegative.objects.
- Compute sum of negatives with python instead of an SQL statement
  (since we already got the data with a previous query).
- Fix bug on account property `real_balance` (happened if
  an account has a relative AccountNegative instance but balance_offset
  to NULL).

- More compliant to PEP8
2017-04-06 19:07:13 +02:00
Aurélien Delobelle
f8b71b604c Fewer db accesses on transfers list view.
- Add select_related for `from_acc`, `to_acc` and `group.valid_by`.
- 2 requests instead of (3 * #transfers)
2017-04-06 18:42:00 +02:00