Admin: Amélioration de la gestion des appartenances aux organisations#5595
Conversation
aefb8d1 to
9cb4a26
Compare
4ff8819 to
31cb638
Compare
d9010a3 to
1bb2de6
Compare
| if obj and obj.prescribermembership_set.count() > 200: | ||
| return False | ||
| return True |
There was a problem hiding this comment.
return bool(obj and obj.prescribermembership_set.count() > 200)
There was a problem hiding this comment.
Je me demande si on veut vraiment laisser les admins toucher aux organisations de plus de 100 membres, j’ai du mal à croire qu’il ne reste plus aucun admin sur une organisation de cette taille. 🤷
| memberships_reelname = "prescribermembership_set" | ||
| org_relname = "company" | ||
|
|
||
| def has_change_permission(self, request, obj=...): |
There was a problem hiding this comment.
La signature est obj=None.
|
Je pense qu’un petit test pourrait être utile, quitte à mocker le nombre de memberships pour éviter que le test ne soit trop coûteux. |
This way, we only allow it on the organization page.
|
Je n'ai aucune idée de comment arriver à mocker le related manager |
1bb2de6 to
988aca1
Compare
|
J’imaginais plutôt stocker la limite (100, 200, ton choix 😛) dans une constante et mocker la constante dans le test (pour mettre par exemple 2), et ainsi ne créer que 3 memberships. |
For organization with more than 250 members, we go over the DATA_UPLOAD_MAX_NUMBER_FIELDS limit of 1000. Make the memberships readonly when they have too many (let supportix or another member of the organization add the user) We have less than 10 organizations with more than 200 members No need to make this change for companies and institutions since we have respectively at most 42 and 23 memberships as of today.
988aca1 to
8eea51f
Compare
| ) in caplog.messages | ||
|
|
||
|
|
||
| def test_admin_more_than_100_memberships(admin_client, mocker): |
There was a problem hiding this comment.
Hahaha, comme tu ne savais plus entre 100, 200 et 3, tu as mis 100 dans le titre et 2 dans le test ? 😂
🤔 Pourquoi ?
This way, we only allow it on the organization page.
We now need to handle the following issue : for organization with more than 250 members, we have more than DATA_UPLOAD_MAX_NUMBER_FIELDS limit of 1000.
We could make all the inlined memberships readonly ig there are too many and allow to change them from the user detail page ?
Or handle the memberships from a dedicated page that we filter from the url (?user=X or ?company=Y)
🍰 Comment ?
🚨 À vérifier
🏝️ Comment tester ?
💻 Captures d'écran