python / python/pythondotorg

Bug: Nominee list shows nominations of you, not nominations you made, and ignores the election

Open
#3,094 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.7k
Forks
700
Avg merge
2d 13h
Merged PRs (30d)
11

Description

Describe the bug

Before I let the Robots take over, @jonafato reported this, and I found a second bug while exploring it. Back to the robots...

While an election's nomination window is still open, the nominee list shows you the nominations of you, not the nominations you made for other people. It is also not scoped to the election in the URL, so it mixes in nominees from every past election cycle.

The page tells you it is doing something else. The template prints "Nominations close at ..., this is a preview of only nominations relevant to you."

The cause is in NomineeList.get_queryset (apps/nominations/views.py):

if self.request.user.is_authenticated:
    return Nominee.objects.filter(user=self.request.user)

Nominee.user is the person being nominated, so this returns the rows where you are the candidate. The branch above it filters on election=election; this one does not.

There is a second, related problem. Each row in the list links to NomineeDetail, which 404s unless Nominee.visible() passes. visible() (apps/nominations/models.py) returns True only for staff, for the nominee themselves, or after nominations close. So even once the list shows the people you nominated, a non-staff nominator who clicks one of those links gets a 404 during the open window.

NomineeList has no test, which is likely why this went unnoticed.

To Reproduce
  1. Sign in as an ordinary (non-staff) user.
  2. Have that user submit a nomination for somebody else in an election whose nomination window is open.
  3. Go to /nominations/elections/<election-slug>/nominees/.
  4. The person you nominated is absent. Any election in which somebody nominated you, including closed past elections, is present.
Expected behavior

While nominations are open, the list should show the nominees relevant to you in the election named in the URL. That means the people you nominated, plus your own candidacy if somebody nominated you. Nominees from other election cycles should not appear. Following a link from that list to a nominee you nominated should open the nominee page rather than a 404.

URL to the issue

https://www.python.org/nominations/elections/2026-python-packaging-council/nominees/

Screenshots
"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"
Browsers

Other

Operating System

Other

Browser Version

No response

Relevant log output

Additional context

This is server-side queryset logic, so it does not depend on the browser or the operating system.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with NomineeList.get_queryset in apps/nominations/views.py and Nominee.visible() in apps/nominations/models.py, then trace the NomineeDetail link from the election nominees URL. Add coverage for an ordinary user during an open election, including election scoping and nominee links. Done means the list shows relevant nominees only for the URL election and those links no longer 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.