Skip to content

Generic form system: grant admin display + export (PR 4/5) - #4710

Open
marcoacierno wants to merge 6 commits into
generic-forms/03-grants-backendfrom
generic-forms/04-admin
Open

Generic form system: grant admin display + export (PR 4/5)#4710
marcoacierno wants to merge 6 commits into
generic-forms/03-grants-backendfrom
generic-forms/04-admin

Conversation

@marcoacierno

Copy link
Copy Markdown
Member

Summary

Fourth PR of the stack (stacked on #4709#4707#4705). Organizers see and export dynamic answers.

  • Grant change page: read-only "Dynamic form answers" block in "The Grant" fieldset — question label → formatted value (option ids resolved to labels, booleans as Yes/No, orphaned question ids shown as Question <id>), question-ordered. Empty state for legacy grants.
  • CSV export: one column per question of the conference's grant form. Columns are added in GrantResource.before_export (runs before headers are built and already resolves the conference — same spot as the existing submissions prefetch); values via an export_field override (dehydrate_method only takes method names, so per-question closures aren't possible). Historical grants export empty cells; the legacy soft-question columns stay untouched. Export queryset gains select_related("form_answer").
  • Shared display_answer_value / display_answers helpers live in generic_forms/services.py.

Test plan

  • Display: labels + formatted values rendered; "No dynamic answers" empty state
  • Export: question columns present with formatted values; legacy grant row exports empty cells; conference without a form exports exactly the old columns
  • Helper tests: per-type formatting, question ordering, deactivated + orphaned questions
  • Full suite 1214 passed; ruff + format clean

Stack: #4705#4707#4709PR4 (this) → PR5 frontend.

display_answer_value renders a stored value per question type (option
labels, Yes/No booleans); display_answers pairs a FormAnswer's values
with question labels in question order, appending orphaned question
ids. Shared by the grant admin display and export columns.
The grant change page renders the linked FormAnswer as a read-only
question/answer list in "The Grant" fieldset (empty state for legacy
grants). The CSV export grows one column per question of the
conference's grant form: fields are added in before_export (which runs
before headers are built, and already resolves the conference) and
values come from export_field, since dehydrate_method only supports
method names, not per-question callables. Legacy soft-question columns
stay; historical grants export empty cells.
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pycon Ready Ready Preview Aug 7, 2026 2:47am

Function-local imports moved to module top and aligned with the file's
existing conventions (AdminSite instance, GrantResource in the shared
import block).
@claude

claude Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Adds display helpers for stored generic-form answers and wires them into the grant admin change page (read-only Q&A block) and CSV export (one column per grant-form question via before_export/export_field).

Import order in backend/grants/admin.py: the new generic_forms imports are inserted between conferences.models.conference_voucher and conferences.vouchers, breaking alphabetical/isort ordering (from generic_forms... should come after custom_admin..., before grants.tasks...). This contradicts the PR's "ruff + format clean" claim and ruff check/isort will flag it.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.51%. Comparing base (4528916) to head (2e6ba84).

Additional details and impacted files
@@                         Coverage Diff                         @@
##           generic-forms/03-grants-backend    #4710      +/-   ##
===================================================================
+ Coverage                            92.49%   92.51%   +0.01%     
===================================================================
  Files                                  359      359              
  Lines                                10970    10995      +25     
  Branches                               863      871       +8     
===================================================================
+ Hits                                 10147    10172      +25     
  Misses                                 706      706              
  Partials                               117      117              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant