Skip to content

Fix nominee visibility during open elections - #3099

Draft
Parzival235 wants to merge 3 commits into
python:mainfrom
Parzival235:agent/fix-nominee-visibility
Draft

Fix nominee visibility during open elections#3099
Parzival235 wants to merge 3 commits into
python:mainfrom
Parzival235:agent/fix-nominee-visibility

Conversation

@Parzival235

Copy link
Copy Markdown

Summary

  • scope the open-election nominee list to the election in the URL
  • show both candidates nominated by the signed-in user and the user's own candidacy
  • allow nominators to open nominee detail pages during the nomination window
  • add regression coverage for election scoping and nominee-detail permissions

Root cause

The authenticated-user branch in NomineeList.get_queryset() filtered only on Nominee.user and did not filter by election. This returned nominations of the user across election cycles instead of nominations the user had made in the current election. Separately, Nominee.visible() did not consider the nominator, so a candidate linked from the corrected list still returned 404.

Validation

  • DATABASE_URL=sqlite:///:memory: uv run --group dev python manage.py test apps.nominations.tests — 66 tests passed
  • ruff check apps/nominations/models.py apps/nominations/views.py apps/nominations/tests/test_views.py
  • ruff format --check apps/nominations/models.py apps/nominations/views.py apps/nominations/tests/test_views.py

Fixes #3094

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.

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

1 participant