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.
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).
- 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
- 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.
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.
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.
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.
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.
- 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.
- 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
- 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.