-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(admin): améliorer le filtrage des stats de forum #699
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C’est surprenant de ne pas pouvoir trier par explicit_period
.
Tu peux décorer la méthode explicit_period
avec @admin.display(ordering="date")
pour qu’on puisse l’utiliser comme un tri.
Autrement, ça semble fonctionner.
parameter_name = "forum" | ||
|
||
def lookups(self, request, model_admin): | ||
forums_with_stats = model_admin.model.objects.values_list("forum", flat=True).distinct() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pas grave s’il y a des doublons dans le __in
.
forums_with_stats = model_admin.model.objects.values_list("forum", flat=True).distinct() | |
forums_with_stats = model_admin.model.objects.values_list("forum", flat=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bonne suggestion !
|
||
def lookups(self, request, model_admin): | ||
forums_with_stats = model_admin.model.objects.values_list("forum", flat=True).distinct() | ||
return [(forum.pk, forum.name) for forum in Forum.objects.filter(pk__in=forums_with_stats)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je préfère le style ci-dessous ?
return [(forum.pk, forum.name) for forum in Forum.objects.filter(pk__in=forums_with_stats)] | |
list(Forum.objects.filter(pk__in=forums_with_stats).values("pk", "name")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tant qu’à faire : Forum.objects.filter(pk__in=forums_with_stats).values_list("pk", "name")
;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merci 👍🏿
## Description 🎸 suite #699 ## Type de changement 🚧 technique ### Points d'attention 🦺 amélioration `lookups`
🤖 I have created a release *beep* *boop* --- ## [2.11.0](v2.10.0...v2.11.0) (2024-07-03) ### Features * **admin:** améliorer le filtrage des stats de forum ([#699](#699)) ([cd0d301](cd0d301)) * **admin:** filtrage des stats de forum, ajout tri ([#701](#701)) ([1da74df](1da74df)) * **forum_conversation:** filtrer les questions dans l'espace d'echanges - stats de suivi ([#700](#700)) ([bac6e55](bac6e55)) * **forum_conversation:** filtrer les questions dans l'espace d'échanges ([#681](#681)) ([48cdd07](48cdd07)) * **forum:** Activation de l'AB Test Notation des forums ([#686](#686)) ([c5699d4](c5699d4)) * **forum:** collecter les notations des fiches pratiques ([#677](#677)) ([4c39290](4c39290)) * **home:** MVP zone editoriale sur la page d'accueil ([#703](#703)) ([5e3f759](5e3f759)) * **home:** petites améliorations ([#689](#689)) ([7471451](7471451)) * **notification:** nouveau système des notifications messages ([#697](#697)) ([f2eedd4](f2eedd4)) * **stats:** collecter les stats d'activité hebdo des forums de la documentation ([#691](#691)) ([ab513a8](ab513a8)) * **stats:** page hebdo partenaires fiches pratiques ([#695](#695)) ([f7f26b8](f7f26b8)) ### Bug Fixes * **cron.json:** erreur copier-coller sur send_notifications_daily.sh ([#705](#705)) ([32f59ed](32f59ed)) * **forum:** ab test forum rating ([#687](#687)) ([f0e9c2b](f0e9c2b)) * **forum:** ab test forum rating ([#688](#688)) ([d3027e4](d3027e4)) * **notification:** mettre à jour le sent_at pour éviter les notifications duplicates ([#707](#707)) ([fca7f29](fca7f29)) * **stats:** derniere date collectée des stats matomo ([#684](#684)) ([015e08b](015e08b)) * **stats:** gel du temps dans les tests de la vue `StatistiquesPageView` ([#702](#702)) ([df66524](df66524)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Description
🎸 rendre la période de la statistiques plus explicite
🎸 filtrer uniquement sur les forums ayant des stats (actuellement les forums de documentation)
Type de changement
🎨 changement d'UI / ADMIN
🚧 technique
Captures d'écran (optionnel)
Admin Stat
Admin ForumStat