Commit graph

949 commits

Author SHA1 Message Date
Martin Pépin
2964d3a4aa
K-FêT: new year = new promo = new migration 2019-10-16 19:43:20 +02:00
Ludovic Stephan
4da5add25a
Move choices_length to shared folder 2019-10-15 21:51:23 +02:00
Martin Pépin
d37c41e99f kfet/test_views: more eloquent test names 2019-10-05 13:48:29 +02:00
Martin Pépin
e0285607a0
Fix tests according to issue #224 2019-10-05 02:25:05 +02: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
8d30c5c7e5 Fix tests 2019-06-17 22:02:11 +02:00
Ludovic Stephan
fb56293273 Supprime un formulaire inutilisé 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
f3dbb72f69 Consistency for on_delete attributes 2019-06-03 22:43:47 +02:00
Ludovic Stephan
d4be8b426e Tests pour la suppression d'articles 2019-05-29 18:29:15 +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
f12370a6cd Tests (!!) 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
63fff6ca7c Setup deleted account
Pour pouvoir supprimer un compte, on crée un compte dummy qui a pour but
de recevoir les objets non supprimables (caisses, transferts/opérations
pour statistiques, etc.). Lors de la délétion d'un compte, tout est
transféré sur le dummy, qui est créé via migration.
2019-05-29 18:29:15 +02:00
Ludovic Stephan
85b1e974ff Change deletion behaviour
Tous les `on_delete` étaient mis à PROTECT, ce qui faisait qu'on ne
pouvait rien supprimer... On les met à CASCADE pour tous les modèles
secondaires (`AccountNegative`, `CheckoutStatement`, `InventoryArticle`,
`SupplierArticle`, `Order` et `OrderArticle`) et pour les inventaires
créés à partir d'une commande.

Pour les modèles qui demandent une validation, et pour les `Operation`s,
on met à NULL le compte ou l'article associé (cela ne change pas le
total d'une opération, qui est la partie importante à garder).
2019-05-29 18:29:15 +02:00
Ludovic Stephan
3a5eceba83 Delete unused models
Certains modèles n'étaient pas utilisés dans le code, on en profite pour
les virer.
2019-05-29 18:29:15 +02:00
Ludovic Stephan
198658f5f9 Misc fixes
- on vire un commentaire obsolète, et on en remet un à jour
- un peu de doc sur les converters
2019-05-21 15:30:51 +02:00
Ludovic Stephan
03c74a7940 Misc fixes 2019-04-17 20:50:49 +02:00
Ludovic Stephan
271732f40d K-Fêt urlconf file + converter 2019-04-12 17:06:53 +02:00
Ludovic Stephan
f32e4a9b0d Fix error 2019-04-12 17:03:42 +02:00
Ludovic Stephan
5fd4cb5c78 Change django.core.urlresolvers imports
-- compatible with 1.11 --
2019-03-19 10:18:56 +01:00
Robin Champenois
0eccfcf886 Merge branch 'Aufinal/webfonts' into 'master'
Sert les polices en local

See merge request klub-dev-ens/gestioCOF!354
2019-02-18 22:40:10 +01:00
Evarin
1043e5725a Fix content-type fixtures K-Fêt 2019-02-18 21:54:26 +01:00
Ludovic Stephan
85642d00d8 Sert les polices en local 2019-02-13 16:54:42 +01:00
Evarin
4f6579c3d1 Fixtures à jour pour Wagtail2 et wagtail-translation 0.9 2019-02-11 21:10:11 +01:00
Ludovic Stephan
1c45dd833d Black + isort 2019-02-09 15:16:40 +01:00
Evarin
0f1e05acdd Migration vers Wagtail 2.3 et Wagtail-modeltranslation 0.9
Toutes les pages Wagtail doivent désormais être traduites
Suppression du modèle COFUtilPage devenu inutile
Réinitialisation des migrations de Wagtail à cause des changements de ModelTranslation
2019-02-04 22:56:48 +01:00
Aurélien Delobelle
b65d37b141 style: black 2019-01-13 13:56:03 +01:00
Martin Pépin
670fda3c9c migrations nécessaires en prod ?!? wtf 2019-01-07 23:30:56 +01:00
Aurélien Delobelle
5d14fef032 kfet.tests -- More isolated tests for kfet.open 2019-01-06 13:49:07 +01:00
Aurélien Delobelle
7ca0144004 kfet.tests -- Deterministic responses for cancel_operation 2019-01-06 13:49:07 +01:00
Martin Pepin
e0e75b53bb Merge branch 'aureplop/ci_parallel' into 'master'
core.ci -- Run tests in parallel

See merge request klub-dev-ens/gestioCOF!327
2019-01-05 19:36:20 +01:00
Aurélien Delobelle
aba0be7960 kfet.test -- Isolate kfet_open in testcases to avoid cache collisions 2019-01-05 19:19:58 +01:00
Aurélien Delobelle
b69f1b6dbc kfet.tests -- Add tests for cancel_operations view 2018-10-21 13:07:44 +02:00
Aurélien Delobelle
d7ca072af3 kfet.tests -- Add factories for many kfet models
- Article
- ArticleCategory
- Checkout
- CheckoutStatement
- Inventory
- InventoryArticle
- Operation
- OperationGroup
2018-10-21 12:50:09 +02: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
507a59c914 kfet.tests -- Add tests for perform_operations view 2018-10-04 11:25:10 +02:00
Aurélien Delobelle
22011faba9 kfet -- Init KFetConfig, even without request, for easy testing 2018-10-04 11:25:10 +02:00
Aurélien Delobelle
0f688a8f1c kfet -- Stack errors of KPsulOperationForm
Delete an error never raised, and avoid duplicate messages.
2018-10-04 11:25:10 +02:00
Aurélien Delobelle
93d3c124fd kfet -- Add fixme related to available checkouts in K-Psul 2018-10-04 11:25:10 +02:00
Aurélien Delobelle
79c26c9dd6 kfet -- Remove unused view 2018-10-01 15:37:41 +02:00
Martin Pépin
a750c62baf New year, new promotion: 2018 2018-09-02 23:27:21 +02:00
Aurélien Delobelle
645c01ebd1 kfet -- As a kfet staff, remove the requirement to…
provide a password in the edit view of an account.
2018-06-16 12:33:51 +02:00
Ludovic Stephan
837b48af36 Fix js path for autocomplete 2018-05-29 14:39:29 +02:00
Martin Pépin
b0301f0304 fix slugurl name error 2018-05-28 00:07:34 +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
53a4c78903 Remove duplicate line 2018-04-07 14:21:07 +02:00
Martin Pépin
158b19778b also sort the unsold table 2018-04-07 14:20:41 +02:00
Martin Pépin
6d0ec6de43 Merge branch 'master' into qwann/separate_list 2018-04-07 14:09:48 +02:00
Martin Pépin
71b4e6253d Merge branch 'master' into aureplop/cof-tests_calendar 2018-04-07 13:42:19 +02:00
Martin Pépin
fba105fdd1 Merge branch 'master' into aureplop/kfet-sticky_thead 2018-04-07 13:32:20 +02:00
Martin Pépin
bf464f9378 Merge branch 'master' into aureplop/cof-tests_event 2018-04-06 00:16:08 +02:00
Martin Pépin
35e17a81a6 New year -> new promo -> migration in k-fet 2018-04-05 23:48:53 +02:00
Qwann
cc27e4d964 show not sold article in a different list 2018-03-22 15:25:03 +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
Martin Pepin
c94a9ecb44 Merge branch 'aureplop/kfet_initial-statement' into 'master'
kfet -- Create initial statement on checkout save

See merge request cof-geek/gestioCOF!283
2018-02-05 22:42:04 +01:00
Martin Pepin
a3295ca6a3 Merge branch 'aureplop/fix-184' into 'master'
Fix available checkouts in K-Psul

Closes #184

See merge request cof-geek/gestioCOF!282
2018-02-05 22:35:04 +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
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
Aurélien Delobelle
525bb4d16d kfet -- Fix available checkouts in K-Psul
The checkout validity is checked using the current datetime (when
requesting the kpsul page).
2018-01-15 17:03:57 +01:00
Aurélien Delobelle
e23e1bdba6 kfet -- Add test to check the choices of checkouts in K-Psul
Particularly, it adds a regression test for #184.
2018-01-15 17:01:06 +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
Aurélien Delobelle
44eee9be38 Merge branch 'aureplop/py34-compat' into 'master'
py34 compat

See merge request !279
2018-01-10 17:30:44 +01:00
Aurélien Delobelle
f58f120e7a py34 compat
(already present in prod)
2018-01-10 17:25:07 +01:00
Martin Pépin
62d8c2ffaf remove @py2_unicode_compat + six 2018-01-06 16:10:13 +01:00
Martin Pépin
97eed06b6f Remove builtins imports 2018-01-06 16:10:13 +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
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
Qwann
93fa79128c order table striped 2017-10-31 15:10:21 +01:00
Aurélien Delobelle
895f7e062c Delete GlobalPermissions model (migrations)
It is an old model which doesn't exist anymore in kfet.models module.

This adds its missing DeleteModel in migrations.
2017-10-27 03:38:28 +02:00
Aurélien Delobelle
8e8e9aa076 Fix migration history 2017-10-24 19:25:20 +02:00
Aurélien Delobelle
af3a7cf697 Reapply fix to kfetauth (…) and fix tests 2017-10-24 17:56:14 +02:00
Aurélien Delobelle
1cc51f17a3 Prevent connection to LDAP when settings is None 2017-10-24 17:55:02 +02:00
Aurélien Delobelle
8673da1874 Fix migration conflict 2017-10-24 16:52:57 +02:00
Aurélien Delobelle
8cdb4c62fc Merge branch 'master' into test/views 2017-10-24 16:45:26 +02:00
Martin Pépin
fccad5edee rename root -> kfet_genericteam in fixtures 2017-10-16 14:31:02 +02:00
Aurélien Delobelle
85657591f5 Fix fields cleaning with unreachable items when…
… object is being created.
2017-10-12 11:10:30 +02:00
Martin Pépin
e0ab7f5f94 Fix migration conflict 2017-10-10 21:21:28 +02:00
Martin Pépin
116b4da1a5 Merge branch 'test/views_kfet' into test/views 2017-10-10 21:15:49 +02:00
Martin Pépin
3d22a1b029 Merge branch 'master' into test/views 2017-10-10 15:39:18 +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
3fa7754ff4 KFet Backends inherit from BaseKFetBackend
Users who authenticate via a KFetBackend got extra select related.
It should save 2 db queries on each request for these users.
2017-09-23 20:48:28 +02:00
Aurélien Delobelle
e5d19811e8 Clean code related to kfet password 2017-09-22 23:31:46 +02:00
Aurélien Delobelle
1d19d1797c Clean setup/retrieve of kfet generic account 2017-09-22 01:24:44 +02:00
Aurélien Delobelle
bf61e41b50 Move auth-related from 'kfet' app to 'kfet.auth'. 2017-09-19 17:05:51 +02:00
Aurélien Delobelle
9e61887868 K-Fêt' groups edits don't remove non-kfet app permissions.
Fixes #168.
2017-09-11 16:42:14 +02:00
Martin Pépin
faed7bff73 fix ?next=… on K-Fêt logout 2017-09-10 02:32:21 +02:00
Martin Pepin
f581279825 Merge branch 'aureplop/fix-kfet-navbar' into 'master'
Fix kfet navbar on small devices

See merge request !248
2017-09-10 02:12:49 +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
Martin Pépin
50432d969f Update available promos for account creation 2017-09-04 13:25:45 +02:00
Martin Pépin
51f4bf3fb5 Clipper logins may be > 8 characters 2017-09-04 13:25:09 +02:00
Aurélien Delobelle
fb5ba5fb1b Fix kfet navbar on small devices 2017-09-03 14:42:38 +02:00
Aurélien Delobelle
af97c0cda6 Improve users management on kfet TestCase, and Py34 compat 2017-09-01 16:37:14 +02:00
Aurélien Delobelle
997b63d6b6 More docs for kfet.tests.utils 2017-09-01 13:35:32 +02:00
Aurélien Delobelle
7d490f0253 Merge branch 'test/views' into test/views_kfet 2017-09-01 12:41:31 +02:00
Aurélien Delobelle
5220bb75d0 Merge branch 'test/views_kfet' of git.eleves.ens.fr:cof-geek/gestioCOF into test/views_kfet 2017-09-01 12:40:37 +02:00
Aurélien Delobelle
d8391e54a5 Add docs to kfet TestCases 2017-09-01 12:39:17 +02:00
Aurélien Delobelle
be1e67626c Most data of suppliers should be optionnal. 2017-08-30 15:35:20 +02:00
Martin Pepin
0afbd577b1 Merge branch 'aureplop/fix_view_account_search' into 'test/views_kfet'
View 'search account' should be restricted.

See merge request !245
2017-08-29 20:41:49 +02:00
Aurélien Delobelle
b4338ce8db View 'search account' should be restricted. 2017-08-16 22:54:40 +02:00
Aurélien Delobelle
22d8317dee Fix kfet.open.tests
Due to messages sent in signals handlers, the tests were failing.
2017-08-16 22:43:52 +02:00
Aurélien Delobelle
b4b15ab371 Tests of kfet config views pass 2017-08-16 22:30:17 +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
2cfce1c921 Add tests for kfet views.
kfet.tests.testcases embed mixins for TestCase:
- TestCaseMixin provides assertion helpers,
- ViewTestCaseMixin provides a few basic tests, which are common to
every view.

kfet.tests.utils provides helpers for users and permissions management.

Each kfet view get a testcase (at least very basic) in
kfet.tests.test_views.
2017-08-16 17:45:59 +02:00
Aurélien Delobelle
c9aac8a49d [WIP] Tests for kfet views 2017-08-10 15:02:08 +02:00
Aurélien Delobelle
878c617cc7 fix PermConsumerMixin 2017-06-25 22:29:12 +02:00
Martin Pépin
68c1b45342 Add missing migrations 2017-06-25 16:30:49 +01:00
Aurélien Delobelle
455b730cc3 Merge branch 'master' into aureplop/kfet_cms 2017-06-23 02:53:05 +02:00
Aurélien Delobelle
815ba50603 fix for small devices 2017-06-22 16:59:41 +02:00
Aurélien Delobelle
5673fabeff Better status management.
Status is mainly computed in Python. That fix inconsistent datetime between
client and server.

Client only receives status and keep timestamp of last received ws msg.
2017-06-22 16:36:08 +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
98f5f0c391 update refresh/unknown interval 2017-06-22 05:44:05 +02:00
Aurélien Delobelle
782e105644 typo 2017-06-21 23:31:27 +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
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
1499c0bced Improvements for K-Fêt CMS.
K-Fêt - Wagtail
- Page content becomes a StreamField.
- GroupTeam snippet becomes a block for stream field.
- Navigation menu moved becomes a "flatmenu", preventing possible future conflicts.
- Page layout can be modified in wagtail admin.

K-Fêt
- Add shorthands for ukf account balance/article price.
- Cleaning stylesheets and templates.
2017-06-12 01:51:10 +02:00
Aurélien Delobelle
6e82a2cf88 minor fix 2017-05-31 22:00:51 +02:00
Aurélien Delobelle
5bed02c3fc Merge branch 'Kerl/banner' into 'master'
Add an announcement banner

Closes #151

See merge request !236
2017-05-30 23:35:08 +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
b13e992a30 Merge branch 'aureplop/clean_scroll' into 'master'
Misc UI

Closes #90 and #115

See merge request !225
2017-05-25 23:03:40 +02:00
Aurélien Delobelle
0815c96c1c Merge branch 'Kerl/postgres' into 'master'
Préparation au passage à postgres
- Suppression du champ num du modèle CofProfile.
- Suppression des LOCK (spécifique MySQL).
- Le code devient compatible avec tous les backends supportés par Django.
- Suppressions de code servant à la compatibilité python2.
- Corrige le message de succès à la fin de l'inscription. Celui-ci ne prenait pas en compte le statut is_cof à jour du profil.

See merge request !234
2017-05-23 22:50:10 +02:00
Martin Pépin
3a69c3371f Simple test: we can query the account-read page 2017-05-23 20:38:53 +01:00
Aurélien Delobelle
1d269ef4f9 Update migration to keep perms.
If content type for old kfet.GlobalPermissions exists:
- custom permissions related to this content type are updated to new content types,
- then we can safely remove this content type.
2017-05-23 16:48:33 +02:00
Aurélien Delobelle
cd5a2e0591 Move K-Fêt global permissions. 2017-05-23 13:47:40 +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
1845ce825f jpp
Fixes #90
2017-05-19 20:13:36 +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
c11c3f84ed clean big tables forms 2017-05-19 16:42:26 +02:00
Aurélien Delobelle
4344b7d537 chrome support 2017-05-19 15:13:27 +02:00
Aurélien Delobelle
0995f712ca clean hover/focus/disabled btn 2017-05-19 14:48:57 +02:00
Aurélien Delobelle
ecce2fda21 Merge branch 'master' into aureplop/clean_scroll 2017-05-19 14:08:57 +02:00
Aurélien Delobelle
51dca32d05 shorter transitions 2017-05-19 14:01:13 +02:00
Aurélien Delobelle
ae27065626 Group permissions select multiple -> checkboxes
- Add handler for CheckboxSelectMultiple in form_field_snippet.html.
- Add template filter "widget_type" to get widget class name.
- Group permissions selection becomes easier.
2017-05-19 13:42:41 +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
Aurélien Delobelle
95a8b484e0 Merge branch 'Aufinal/fix_history' into 'master'
Fix asynchronous calls with resetSettings

See merge request !229
2017-05-15 23:43:28 +02:00
Ludovic Stephan
647b32e727 Move displayAddcost function 2017-05-15 17:52:49 -03:00
Martin Pepin
6871945dcd Merge branch 'aureplop/fix_perms' into 'master'
Fix UserGroupForm

Closes #161

See merge request !228
2017-05-15 11:29:33 +02:00
Ludovic Stephan
bf0e345301 Fix asynchronous calls with resetSettings
The `resetSettings` function now returns the ajax object, allowing to
chain other calls to it, e.g. the `getHistory` function.
2017-05-14 23:50:09 -03:00
Aurélien Delobelle
e0b1db1e1e more robust tests 2017-05-14 22:19:25 +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
4ac7b30bdd Fix UserGroupForm + tests for this form.
- Non-K-Fêt group membership is no longer erased by the account edit
  form.
- Add some tests to ensure proposed choices in this form corresponds to
  K-Fêt groups + test case for #161.

Fixes #161
2017-05-12 16:55:18 +02:00
Aurélien Delobelle
b1e46792c8 (little) cleaning of order_create view 2017-05-10 13:11:47 +02:00
Aurélien Delobelle
b0e7ebfbc5 fix typo + pep8 + del future imports 2017-05-10 12:49:14 +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
739990cdb6 Add total boxes to new inventory view + fix/clean
- Add total boxes in cellar and bar to new inventory view.
- On this view, table is "minified".
- Revert background color for some templates.
- Clean some margin (responsively).
- Clean tab pills on account read.
2017-04-22 01:17:23 +02:00
Aurélien Delobelle
2eee8f58aa Merge branch 'master' into aureplop/fewer_requests 2017-04-17 20:45:01 +02:00
Aurélien Delobelle
ce23eece6a Fix display on small screen devices.
- Remove useless margin on small screens.
- Better pills display on small screens.
- Revert to transparent background for section title.
2017-04-15 13:03:01 +02:00
Aurélien Delobelle
ea81ab7b25 Few display improvements.
- Current day remains on the screen on history.
- Message for generic team user connection is sended only if user is
  connecting from a k-fet url.
- Less contrast on history.
2017-04-15 12:36:11 +02:00
Aurélien Delobelle
0a21858b33 Use css for scroll positionning
- Better rendering on scroll on pages with a left block
(- It removes the warning on Firefox about scroll positionning)
2017-04-14 13:08:03 +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
b357283f87 Merge branch 'master' into aureplop/clean_channels 2017-04-11 00:32:07 +02: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
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
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
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
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
Ludovic Stephan
e26668e5eb Add tabs to account_read 2017-04-06 21:17:47 -03: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
1302adf156 globally fewer db requests 2017-04-06 14:15:03 +02:00
Aurélien Delobelle
f57bab8ae9 createopes use only bulk_create
createopes script:
- more than 6x faster
- only bulk_create is used instead of create or save
- correctly create editions (~5% of created operations)
- ratio of withdrawals go from ~10% to ~5%
2017-04-06 13:33:40 +02:00
Aurélien Delobelle
4b2e20e728 created_at required with default 2017-04-06 00:31:04 +02:00
Aurélien Delobelle
e2d7192b23 fix perform opes after account reset 2017-04-06 00:11:41 +02:00
Aurélien Delobelle
c849306a32 fix kfet home template 2017-04-06 00:00:53 +02:00
Qwann
ef8fec89fe migration renamed 2017-04-05 17:50:49 +02:00
Qwann
a5671fdf4c Merge branch 'master' into qwann/k-fet/kfet_open 2017-04-05 17:40:19 +02:00
Aurélien Delobelle
3ee9de93d9 few improvements on article category
- add verbose names to ArticleCategory fields
- add button to view categories list from articles list
- fix article_update template in form validation
- improve interface for articlecategory_update
- revert vanished urls (happened in merge with master...)
2017-04-05 15:34:28 +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
Martin Pépin
85ba44c231 Tests the redirection using the appropriate method 2017-04-04 23:31:24 +01: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
dc07b072ab Flatten scale args in GET params of stats urls
- get_scale_args method of ScaleMixin retrieves useful GET params for
  Scale object instanciation (by default from request.GET)
- it takes into account the type of the scale arg
- prefix used for GET param can be modified in stats_manifest funcs and
  ScaleMixin
2017-04-04 20:12:21 +02:00
Aurélien Delobelle
885e40fd05 cleaner scales
- References to `Stat` in `Scale` objects are deleted (because scales
  are independent of stats)
- KFET_WAKES_UP_AT is now a time object insted of an hour
- Proper use of date, datetime, timedelta, etc (django.utils.timezone
  provides neither datetime nor timedelta)
2017-04-04 18:11:15 +02:00
Aurélien Delobelle
ddd71c7ac1 add missing __init__ 2017-04-04 17:29:54 +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
0405eee7a7 Merge branch 'Aufinal/inventaires' into 'master'
K-Fêt - Création d'inventaires
- Amélioration de l'interface
- Ajout de colonnes intermédiaires pour faciliter le calcul
- Ajout d'indication de conflits possibles avec les opérations en cours
- Résolution semi-automatique de ces conflits

Closes #141

See merge request !200
2017-04-04 10:59:09 +02:00
Martin Pépin
b383923d49 Merge branch 'Kerl/test_stats' into aureplop/fix_stats 2017-04-04 09:39:26 +01: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
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
ce2a05766d Add set_many methods to kfet_config
- Fix addcost updates (from K-Psul)
2017-04-03 23:06:47 +02:00
Ludovic Stephan
51acb4e00a Use new WS class 2017-04-03 16:05:18 -03:00
Ludovic Stephan
32474a6865 Don't update input when unchecking 2017-04-03 16:03:22 -03:00
Ludovic Stephan
f46ba0dd6c Merge branch 'master' into Aufinal/inventaires 2017-04-03 16:01:51 -03:00
Aurélien Delobelle
7384465cbd fix migrations order 2017-04-03 21:01:36 +02:00
Aurélien Delobelle
921dce1f35 Merge branch 'master' into aureplop/kfet_config 2017-04-03 20:58:57 +02:00
Ludovic Stephan
5607d7c9a4 Migration pour kfet_forms 2017-04-03 15:54:02 -03:00
Ludovic Stephan
ad2c8537e3 Add Runpython (oops) 2017-04-03 15:50:18 -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
6d2e150aa0 clean align 2017-04-03 16:56:44 +02:00
Aurélien Delobelle
903da795ab clean kfet statistic.js
- no longer dictToArray where it isn't necessary (because already an
  array)
- fix chart height:
  - previous charts were causing bugs
  - height is fixed (even with window resizing)
- clean whitespaces
2017-04-03 16:53:28 +02:00
Ludovic Stephan
40da3bc299 Listen on input 2017-04-03 11:21:05 -03:00
Ludovic Stephan
b113a57b74 Fix update function 2017-04-03 11:20:56 -03: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
Aurélien Delobelle
769c37634d delete debug msg 2017-04-03 15:43:56 +02:00
Aurélien Delobelle
1bb83ccdd7 simplify StatScale 2017-04-03 15:10:53 +02:00
Aurélien Delobelle
7dc233c0e2 Merge branch 'Aufinal/editions' into 'master'
K-Fêt
- Fix: Les éditions ne touchent plus la caisse
- Fix: Seuls les achats sont possibles sur LIQ

See merge request !198
2017-04-03 14:39:53 +02:00
Aurélien Delobelle
b157ffac4c Merge branch 'Aufinal/kfet_forms' into 'master'
K-Fêt
- Affichage des formulaires amélioré

See merge request !203
2017-04-03 13:40:41 +02:00
Aurélien Delobelle
b3a9ad8a96 clean mixin 2017-04-03 13:24:04 +02:00
Aurélien Delobelle
d97a7be819 stats: fix begin of balances graphs
- graph begin at first operation or later
2017-04-03 03:15:07 +02:00
Aurélien Delobelle
c01de558e1 Clean Article stats
kfet.statistic
- delete no longer used defs
- new mixin - ScaleMixin
  - get scale args from GET params
  - chunkify querysets according to a scale

Article stats
- use SingleResumeStat for manifest
- use ScaleMixin for sales
- update urls
- update permission required: teamkfet

Account stats
- update permission required: teamkfet
- operations use ScaleMixin
- fix manifests urls
2017-04-03 03:12:52 +02:00