Skip to content

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

Description

@jefftriplett

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis is a bug!

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions