Skip to content

feat: show leaderboards inline in project Django admin page#4323

Draft
SylvainChevalier wants to merge 3 commits intomainfrom
claude/issue-4305-20260210-1451
Draft

feat: show leaderboards inline in project Django admin page#4323
SylvainChevalier wants to merge 3 commits intomainfrom
claude/issue-4305-20260210-1451

Conversation

@SylvainChevalier
Copy link
Contributor

Adds a LeaderboardInline to ProjectAdmin so all leaderboards associated with a project are visible directly on the project change page.

Closes #4305

Generated with Claude Code

Adds a LeaderboardInline to ProjectAdmin so all leaderboards associated
with a project are visible directly on the project change page. Each row
shows the leaderboard's score type, time range, finalize time, finalized
status, prize pool, and whether it is the primary leaderboard. The
leaderboard name links to its own change page for easy navigation.

Closes #4305

Co-authored-by: Sylvain <SylvainChevalier@users.noreply.github.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/issue-4305-20260210-1451

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

🚀 Preview Environment

Your preview environment is ready!

Resource Details
🌐 Preview URL https://metaculus-pr-4323-claude-issue-4305-20260210-145-preview.mtcl.cc
📦 Docker Image ghcr.io/metaculus/metaculus:claude-issue-4305-20260210-1451-b9e9107
🗄️ PostgreSQL NeonDB branch preview/pr-4323-claude-issue-4305-20260210-145
Redis Fly Redis mtc-redis-pr-4323-claude-issue-4305-20260210-145

Details

  • Commit: e6cc44eb44c7476f0c375b3d0f00c6e8271c8819
  • Branch: claude/issue-4305-20260210-1451
  • Fly App: metaculus-pr-4323-claude-issue-4305-20260210-145

ℹ️ Preview Environment Info

Isolation:

  • PostgreSQL and Redis are fully isolated from production
  • Each PR gets its own database branch and Redis instance
  • Changes pushed to this PR will trigger a new deployment

Limitations:

  • Background workers and cron jobs are not deployed in preview environments
  • If you need to test background jobs, use Heroku staging environments

Cleanup:

  • This preview will be automatically destroyed when the PR is closed

@SylvainChevalier
Copy link
Contributor Author

@claude some QA feedback:

  • the fields in the table should be read-only.
  • the leaderboard name is repeated twice: in the first and second cells of each row.
  • the table should be all the way to the bottom of the page.

@claude
Copy link

claude bot commented Feb 12, 2026

Claude finished @SylvainChevalier's task in 1m 36s —— View job


QA Feedback Addressed

All three issues have been fixed in commit 021a780:

  • Make fields read-only — Added all fields (score_type, start_time, end_time, finalize_time, finalized, prize_pool) to readonly_fields so the entire inline is read-only
  • Fix duplicate leaderboard name — Removed show_change_link = True which was rendering the model's __str__ as an extra first column, duplicating the name already shown by leaderboard_link
  • Move table to bottom — Moved LeaderboardInline to the last position in the inlines list so it appears at the bottom of the page
    |

@SylvainChevalier
Copy link
Contributor Author

@claude info is still duplicated. E.g. the first three columns from a table I'm looking at right now:

<td class="original">
          <p>
          
          peer_tournament Leaderboard for MiniBench - Spring Warmup - 2025-12-22
          
          
          
            </p>
          <input type="hidden" name="leaderboards-0-id" value="750" id="id_leaderboards-0-id">
          <input type="hidden" name="leaderboards-0-project" value="32919" id="id_leaderboards-0-project">
        </td>
<td class="field-leaderboard_link">
              
                  <p><a href="/admin/scoring/leaderboard/750/change/">Leaderboard #750 (peer_tournament)</a></p>
              
              </td>
<td class="field-score_type">
              
                  <p>Peer Tournament</p>
              
              </td>

The scoring type is repeated thrice. The name of the project is redundant since we're already on the project page. We should give the link to the leaderboard page, and the scoring type, with not repetition.

@claude
Copy link

claude bot commented Feb 13, 2026

Claude finished @SylvainChevalier's task in 3m 56s —— View job


Duplicate Info Fixed in Leaderboard Inline

  • Read current inline code and understand duplication
  • Create custom tabular inline template to hide the "original" column
  • Update LeaderboardInline to remove score_type and clean up leaderboard_link
  • Commit and push changes

Changes Made

The score type was appearing 3 times per row:

  1. In the "original" column (<td class="original">) — Django's default __str__ rendering showing e.g. peer_tournament Leaderboard for MiniBench - Spring Warmup
  2. In the leaderboard_link column — e.g. Leaderboard #750 (peer_tournament)
  3. In the dedicated score_type column — e.g. Peer Tournament

Fixes applied:

  1. Custom inline template (templates/admin/scoring/leaderboard_readonly_inline.html) — hides the "original" <td> that Django automatically renders with the model's __str__ (which contained the project name and score type). Hidden fields (pk/fk) are preserved in a hidden cell.

  2. Removed score_type from fields — no longer shown as a separate column since the leaderboard link already identifies the type.

  3. Updated leaderboard_link — now uses get_score_type_display() for human-readable labels (e.g. #750 (Peer Tournament) instead of Leaderboard #750 (peer_tournament)). If the leaderboard has a custom name, that's shown instead.

The inline now shows each piece of info exactly once: a clickable link (with score type), start/end/finalize times, finalized status, prize pool, and is_primary.
|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show secondary leaderboards in project django admin page

1 participant