Election updates#3065
Draft
JacobCoffee wants to merge 14 commits into
Draft
Conversation
Co-Authored-By: Codex <codex@openai.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Codex <codex@openai.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
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 newNominationacknowledgment 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 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 %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.