Skip to content

Election updates#3065

Draft
JacobCoffee wants to merge 14 commits into
mainfrom
elections-updates
Draft

Election updates#3065
JacobCoffee wants to merge 14 commits into
mainfrom
elections-updates

Conversation

@JacobCoffee

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 25, 2026 14:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the nominations app to support multiple election “kinds” (e.g., PSF Board vs Packaging Council) with different nomination form variants, adds candidate acknowledgments captured at submission time, and improves rendering/performance around election/kind lookups. It also introduces a server-rendered markdown “statement preview” endpoint and expands test coverage around the new behaviors.

Changes:

  • Add ElectionKind.nomination_form, Election.hide_previous_service, and new Nomination acknowledgment flags; update admin list displays/filters accordingly.
  • Split nomination create forms by election kind (Board vs Packaging Council) and add structured “previous service” fields + acknowledgments rendering.
  • Add a login-protected statement preview endpoint and expand tests for form selection, persistence, permissions, and preview rendering.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
apps/nominations/views.py Reuses election lookup via cached property, selects related objects for fewer queries, adds statement-preview JSON endpoint.
apps/nominations/urls.py Adds route for statement-preview endpoint.
apps/nominations/forms.py Introduces election-kind-specific create forms, acknowledgment validation, and structured previous-service fields.
apps/nominations/models.py Adds form-variant/kind flags, previous-service labeling helpers, nominee mission-alignment display, and acknowledgment fields on nominations.
apps/nominations/admin.py Exposes new model fields in admin list displays and filters.
apps/nominations/migrations/0004_acknowledgments_and_form_variant.py Adds database fields for nomination variants, hiding previous service, and acknowledgments.
apps/nominations/templates/nominations/nomination_form.html Renders fields manually, adds acknowledgments partial, adds statement preview UI + JS, and previous-service UI behaviors.
apps/nominations/templates/nominations/_acknowledgments.html New partial for rendering acknowledgment checkboxes cleanly.
apps/nominations/templates/nominations/nominee_list.html Uses election-provided previous-service label and hides empty previous-service values.
apps/nominations/templates/nominations/nominee_detail.html Uses election-provided previous-service label; displays mission-alignment flag when present.
apps/nominations/templates/nominations/nomination_detail.html Uses election-provided previous-service label and hides empty values.
apps/nominations/templates/nominations/nomination_accept_form.html Uses election-provided previous-service label and hides empty values.
apps/nominations/tests/utils.py Adds shared helpers for creating elections/kinds and building nomination payloads.
apps/nominations/tests/test_views.py Adds tests for form selection, persistence of acknowledgments, permissions, edit variants, and preview behavior.
apps/nominations/tests/test_forms.py Adds unit tests for board/packaging council forms and edit form behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/nominations/views.py
Comment on lines +52 to +56
@cached_property
def election(self):
"""Return the election named by the URL slug."""
return Election.objects.select_related("kind").get(slug=self.kwargs["election"])

Comment on lines +50 to +53
fetch('{% url "nominations:nomination_preview" %}', { method: 'POST', body: body })
.then(function (response) { return response.json(); })
.then(function (data) { target.innerHTML = data.html; target.hidden = false; });
});
Comment on lines +101 to +103
<p><button type="button" id="preview-statement">Preview</button></p>
<div id="statement-preview" hidden></div>
{% endif %}
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.

2 participants