Commit graph

330 commits

Author SHA1 Message Date
Ludovic Stephan 9eebc7fb22 Fix: les transferts apparaissent dans l'historique perso 2020-04-23 18:11:23 +02:00
Ludovic Stephan 2aa06d2954 Simplify transfer view 2020-04-23 18:11:23 +02:00
Ludovic Stephan 931b2c4e1f Refactor js code
Harmonize history denominations
* opegroups/transfergroups -> groups
* opes/transfers -> entries
* snake/camel case -> snake case
2020-04-23 18:11:23 +02:00
Ludovic Stephan b450cb09e6 Petit refactor 2020-04-23 18:11:23 +02:00
Ludovic Stephan 8d11044610 Fix: pas d'erreur quand pas de compte K-Fêt 2020-04-23 18:11:23 +02:00
Ludovic Stephan 677ba5b92e Fix : le ws K-Psul remarche 2020-04-23 18:11:23 +02:00
Ludovic Stephan 7438445110 Last tweaks 2020-04-23 18:11:23 +02:00
Ludovic Stephan 49ef8b3c15 Pas besoin de ws pour les suppressions 2020-04-23 18:11:23 +02:00
Ludovic Stephan af0de33d4c Suppression des opérations et des transferts 2020-04-23 18:11:23 +02:00
Ludovic Stephan 41ad2a15ac Update websocket data 2020-04-23 18:11:23 +02:00
Ludovic Stephan bf117ec070 Renvoie les transferts dans l'historique 2020-04-23 18:11:23 +02:00
Ludovic Stephan a3b0ea9b8d Fetch transfers in history_json 2020-04-23 18:11:23 +02:00
Ludovic Stephan 137dd655d1 Harmonise les comptes non-lisibles ou éditables 2020-03-11 22:30:47 +01:00
Martin Pépin 64c792b11f
Disambiguation in kfet's permission handling
In some places we used to refer to permissions based on their codename
only (the part after the dot "." in the following examples) which can be
ambiguous. Typically, we might define permissions like "bds.is_team" or
"cof.is_team" in the near future ;)
2019-12-24 17:14:45 +01:00
Antonin Reitz e97c873b4f Merge branch 'Aufinal/backbone' into 'master'
Refactor le JS de K-Psul via Backbone : 1ère étape

See merge request klub-dev-ens/gestioCOF!388
2019-12-11 23:19:44 +01:00
Martin Pepin 71e3c210f2 Merge branch 'Aufinal/forgotten_decorators' into 'master'
Rajoute les décorateurs oubliés pour l'auth par mdp

See merge request klub-dev-ens/gestioCOF!389
2019-12-11 19:10:19 +01:00
Ludovic Stephan a4fdb578bc Add forgotten kfet_password decorators 2019-12-02 20:44:25 +01:00
Ludovic Stephan 091208b66c Make kfet.account.read.json accessible with GET 2019-11-29 14:47:12 +01:00
Ludovic Stephan ac3bfbe368 Display in kfet js 2019-11-27 14:14:42 +01:00
Ludovic Stephan affdf43e0b Add logic in views and templates 2019-11-27 14:14:33 +01:00
Ludovic Stephan a60df91b04 Add decorator to needed views 2019-11-21 01:21:26 +01:00
Ludovic Stephan 57088cda03 Fix le problème des prénoms manquants
Depuis !360, quand on modifie son propre compte K-Fêt, cela supprime les
noms associés sur gestioCOF... Le problème est réglé, normalement.
2019-11-03 00:02:34 +01:00
Martin Pépin 96adadce5e
Replace some 403 by 404 to avoid trigramme leaking
Fixes #224
2019-10-05 01:25:36 +02:00
Ludovic Stephan 96430d852c Do not repeat default argument 2019-06-17 22:02:12 +02:00
Ludovic Stephan fc8c8fdf29 Montre les infos à tout le monde 2019-06-17 22:02:11 +02:00
Ludovic Stephan baa3826a42 Change le formulaire de account_update
On fait un formulaire d'info non-éditable pour pas que les gens mettent des noms troll
2019-06-17 22:02:11 +02:00
Ludovic Stephan 56bc281b30 Utilise >= gnagnagna 2019-06-03 23:00:10 +02:00
Ludovic Stephan c4948be1f7 Use http_methods_allowed attribute 2019-06-03 22:59:43 +02:00
Ludovic Stephan 65dd7e5fa3 Suppression d'article
On fait pareil que précédemment pour les articles, en rajoutant une vie
de délétion + de quoi afficher qu'un article a été supprimé.
N.B. : le formatage automatique de VSCode fait plein de changements,
donc pourquoi pas les garder.
2019-05-29 18:29:15 +02:00
Ludovic Stephan 123e2b84df Rename view to fit conventions 2019-05-29 18:29:15 +02:00
Ludovic Stephan 52521e89a6 Add some restrictions on deletion 2019-05-29 18:29:15 +02:00
Ludovic Stephan 08ac0ac890 Vues de suppression
On rajoute un bouton de suppression d'un compte utilisable avec la perm
`kfet.delete_account`, avec message de vérif. On en profite pour
cleanup un peu le css de `jconfirm`.
2019-05-29 18:29:15 +02:00
Ludovic Stephan 5fd4cb5c78 Change django.core.urlresolvers imports
-- compatible with 1.11 --
2019-03-19 10:18:56 +01:00
Aurélien Delobelle 7ca0144004 kfet.tests -- Deterministic responses for cancel_operation 2019-01-06 13:49:07 +01:00
Aurélien Delobelle 402b544393 core -- Fix flake8 errors 2018-10-06 13:15:33 +02:00
Aurélien Delobelle fdd2b35289 core -- Apply black + isort to all files 2018-10-06 13:15:33 +02:00
Aurélien Delobelle 79c26c9dd6 kfet -- Remove unused view 2018-10-01 15:37:41 +02:00
Martin Pépin ea737dab29 Merge branch 'Kerl/drop_py2_compat' of git.eleves.ens.fr:cof-geek/gestioCOF into Kerl/drop_py2_compat 2018-04-16 14:18:21 +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 6d0ec6de43 Merge branch 'master' into qwann/separate_list 2018-04-07 14:09:48 +02:00
Martin Pépin fba105fdd1 Merge branch 'master' into aureplop/kfet-sticky_thead 2018-04-07 13:32:20 +02:00
Qwann cc27e4d964 show not sold article in a different list 2018-03-22 15:25:03 +01:00
Aurélien Delobelle 42e762bc4a Py3 allows to shorten super() 2018-01-16 16:50:27 +01:00
Aurélien Delobelle 478f56d94b kfet -- Create initial statement on checkout save
- Why? Because it should be the actual behavior.
- To allow using arithmetic operations with values of DecimalField when
object are not retrieved from DB, some strings are replaced by Decimal
or int.
If you wonder why it's not automatically done, see:
https://code.djangoproject.com/ticket/27825
2018-01-16 16:49:02 +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 475f1adec5 Remove "coding: utf8" line 2018-01-06 16:10:13 +01:00
Aurélien Delobelle 32720c56a6 kfet -- Tables are sortable
Many tables in kfet app templates become sortable:
account list, negative account list, article list, article inventory
list, article supplier list, article category list, checkout list,
checkout statement list, inventory list, inventory details, order list,
order creation, order details.

This is achieved thanks to the jQuery plugin 'tablesorter':
https://mottie.github.io/tablesorter/docs/

- Affected tables also got sticky headers (it stays visible on scroll).
- Dates format are modified in order to ease the date sorting with the
plugin (it avoids writing a custom parser, or an extractor from
additional hidden element in the table cells).
- Tables whose content is classified by category (of articles) now uses
several tbodies. This has minor effects on the tables style.
- Tags of the header help signs become 'i', instead of 'span', in order
to avoid weird spacing.
2017-11-27 18:24:22 +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
Aurélien Delobelle af3a7cf697 Reapply fix to kfetauth (…) and fix tests 2017-10-24 17:56:14 +02:00
Aurélien Delobelle 8cdb4c62fc Merge branch 'master' into test/views 2017-10-24 16:45:26 +02:00
Martin Pépin 116b4da1a5 Merge branch 'test/views_kfet' into test/views 2017-10-10 21:15:49 +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
Aurélien Delobelle bf61e41b50 Move auth-related from 'kfet' app to 'kfet.auth'. 2017-09-19 17:05:51 +02:00
Martin Pépin 937a485704 Merge branch 'master' into Production 2017-09-09 22:03:32 +02:00
Martin Pépin 35b352ac1d Fix mistake introduced in 51f4bf3fb5 2017-09-04 14:50:12 +02:00
Aurélien Delobelle 414b0eb433 Add missing perms to view/edit kfet config 2017-08-16 21:28:16 +02:00
Aurélien Delobelle 6e82a2cf88 minor fix 2017-05-31 22:00:51 +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
Aurélien Delobelle e60e347a53 Add base templates to extend
- kfet/base_col_1.html for one column content.
- kfet/base_col_2.html for two columns content (left for fixed content,
right for main content).
2017-05-20 13:57:21 +02:00
Aurélien Delobelle 109a692cea Order creation improvements.
- colspan takes into account the scale length.
- add box_capacity
2017-05-19 17:55:31 +02:00
Aurélien Delobelle c0b8430a12 Better scale management for order creation
+ Extends labels formatting of scale.
2017-05-19 17:40:06 +02:00
Aurélien Delobelle ecce2fda21 Merge branch 'master' into aureplop/clean_scroll 2017-05-19 14:08:57 +02:00
Aurélien Delobelle e9073e2265 Improve multiple select inputs
+ Group edition form gains success message, is prettier
+ Fix: K-Fêt prefix for group name on this form
2017-05-18 21:41:23 +02:00
Aurélien Delobelle 1a661c1fd3 revert 2017-05-18 20:29:29 +02:00
Aurélien Delobelle 5776c81764 Clean navbar + content_center only
- Add css transitions on buttons + navbar links.
- Clean css of navbar.
- Clean templates with only centered form/content.
- Page opened when login as generic team user close itself (only for
  non-CAS users).
- A message is added when generic team user connects.
- Fix extra space on right when messages are prompted.
2017-05-18 20:17:05 +02: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 b1e46792c8 (little) cleaning of order_create view 2017-05-10 13:11:47 +02:00
Ludovic Stephan 5c5fc6da1b Merge branch 'aureplop/less_prices_history' into 'master'
Less articles prices history

Closes #142

See merge request !224
2017-04-25 14:32:18 +02:00
Aurélien Delobelle 2eee8f58aa Merge branch 'master' into aureplop/fewer_requests 2017-04-17 20:45:01 +02:00
Aurélien Delobelle 7db497d095 Less articles prices history
- Prices given with order_to_inventory are saved to db only if they are
  updated (it doesn't create a new price row each time)

Fixes #142.
2017-04-13 16:34:29 +02:00
Aurélien Delobelle 9668f1d1ec Account: check_negative() -> update_negative() 2017-04-13 15:48:13 +02:00
Aurélien Delobelle 18425b82c2 Check negative on cancellation.
- Like perform operations, cancel_operations can add/remove an account
  from negative accounts system.
- Balances checks are now performed against real_balance instead of
  balance.
  So if someone with a balance_offset go, for real, to positive land (ie even
  without taking into account the balance offset), its account is removed from
  the negative system.
- Fix bug on real_balance when negative exists but balance_offset is
  not set.

Fixes #156.
2017-04-13 15:15:59 +02:00
Aurélien Delobelle 06572f0bb5 Order create use Scale.
Order create view use WeekScale. No query improvements, only shorter
code.

Scale/ScaleMixin:
- Two methods directly relative to the Scale class move to... the Scale
  class.

- Fix order create on Chrome.
2017-04-13 14:11:44 +02:00
Aurélien Delobelle 3f4a1adbb9 Fewer queries on stats/scales + Fix
Scales:
- Fix #chunks when used with std_chunk=True (there was one too many at
  the beginning)
- Scale.end gives the end of the last chunk (instead of its start)
  So scale.begin -> scale.end gives the full range of the scale.

`kfet_day` now returns an aware datetime.

ScaleMixin:
- new method `get_by_chunks` which use only one query and ranks
  elements according to the scale. Elements are returned by a generator
  for each scale chunk (and all chunks are returned as a generator too).

ArticlesStatSales and AccountStatOperations use this new method to
avoid issuing #scale_chunks queries.

ArticleStat:
- fixed on Chrome
2017-04-12 18:03:31 +02:00
Aurélien Delobelle e97e0081d7 Fewer queries on stats of an account balance.
- Remove labels, should be replaced to an anchor to the relative
  operation in history.
- Add select_related as necessary.
2017-04-11 23:13:54 +02:00
Aurélien Delobelle b5cc26bb1b Merge branch 'master' into aureplop/fewer_requests 2017-04-11 22:46:18 +02:00
Aurélien Delobelle e89ff68d3b add misisng import 2017-04-09 01:39:18 +02:00
Aurélien Delobelle 784ba9bd10 Merge branch 'master' into aureplop/kfet_config 2017-04-08 18:36:28 +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
Aurélien Delobelle 709d421b2c Add custom Manager for Account model.
- When Account model is queried with Account.objects, it always add
  .select_related('cofprofile_user', 'negative').
- Eg benefits: history doesn't do anymore one request by account to
  fill the account filter.

Important

Using this workaround (systemically append select_related) can be
dangerous normally, however a certain number of properties in
cofprofile and user are frequently used (as firstname or lastname), and
the benefits seems greater.
2017-04-06 18:23:27 +02:00
Aurélien Delobelle 33cee05884 initial checkout selected
Result is the same result but:
- auto-select go to javascript
- 1 less request for KPsulCheckoutForm

- delete debug messages
- some PEP8
2017-04-06 16:45:44 +02:00
Aurélien Delobelle 56fa70e495 fewer calls on account_read view 2017-04-06 14:38:25 +02:00
Aurélien Delobelle 42728e58be Merge branch 'master' into qwann/k-fet/category_addcost 2017-04-05 14:57:26 +02:00
Martin Pepin fe66a6ef6b Merge branch 'aureplop/fix_stats' into 'master'
Stats K-Fêt - Python side

See merge request !208
2017-04-05 00:41:47 +02:00
Qwann 7350006990 PEP8 2017-04-04 21:48:17 +02:00
Qwann ba11aa49db categories are updatable 2017-04-04 21:36:02 +02:00
Aurélien Delobelle 714903210c Add kfet_config tests
- KFetConfig `set` method now takes model instance instead of their pk
  for this type of entries.
- Add tests for KFetConfig class: tests against types currently used by
  kfet app (duration, modelinstance, decimal).
- These tests are located in `kfet/tests/test_config.py`. We should
  separate tests suites by file like this, considering what they are about.
- KFetConfig method `set_many` renamed to `set` (because it also updates
  only one).
2017-04-04 17:05:55 +02:00
Qwann 72615bf400 small fixes 2017-04-04 16:57:17 +02:00
Aurélien Delobelle 278459e80f typo....... 2017-04-04 11:05:49 +02:00
Aurélien Delobelle 7989a07b5f cleaner fix 2017-04-04 01:36:19 +02:00
Aurélien Delobelle df467767f4 fix default GET param 'types' on operations stats 2017-04-04 01:29:19 +02:00
Aurélien Delobelle ce2a05766d Add set_many methods to kfet_config
- Fix addcost updates (from K-Psul)
2017-04-03 23:06:47 +02:00
Ludovic Stephan f46ba0dd6c Merge branch 'master' into Aufinal/inventaires 2017-04-03 16:01:51 -03: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
Aurélien Delobelle 10d2b58fa7 clean some comments
- fix: error if actions are empty in balance stats
2017-04-03 17:06:32 +02:00
Aurélien Delobelle 87bc90ec8b Begin/end balance stat graph
- Anytime begin at account creation datetime
- Others doesn't take care of account creation
- Add check to avoid to bug on actions list length
2017-04-03 16:07:31 +02:00