Skip to content

Conversation

@MaciekBaron
Copy link
Contributor

@MaciekBaron MaciekBaron commented Jan 23, 2026

What is the context of this PR?

This PR addresses tickets CMS-972 and CMS-973, and adds support for downloading CSV files from tables and charts from methodology pages, and tables from information pages.

The change involves moving code into a mixin, which we then apply across page models.

The admin URLs have been updated to a more generic structure.

How to review

  1. Create or edit an Information Page and a Methodology Page
  2. Add charts and/or tables
  3. Publish the pages
  4. Confirm that CSV downloads work
  5. Create a draft version
  6. Preview the pages
  7. Confirm that CSV downloads still work

Follow-up Actions

N/A

@MaciekBaron MaciekBaron requested a review from a team as a code owner January 23, 2026 15:55
@MaciekBaron MaciekBaron marked this pull request as draft January 23, 2026 15:55
@MaciekBaron MaciekBaron changed the title [DRAFT] Expand CSV download to methodology page Expand CSV download to methodology and information pages Jan 28, 2026
@MaciekBaron MaciekBaron marked this pull request as ready for review January 28, 2026 12:04
from cms.core.custom_date_format import ons_date_format

# Re-exports for backwards compatibility
from cms.core.utils import create_data_csv_download_response_from_data, sanitize_data_for_csv
Copy link
Contributor

Choose a reason for hiding this comment

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

question: is this really needed?

from wagtail.coreutils import WAGTAIL_APPEND_SLASH

from cms.core.utils import create_data_csv_download_response_from_data, flatten_table_data
from cms.datavis.constants import CHART_BLOCK_TYPES, TABLE_BLOCK_TYPES
Copy link
Contributor

Choose a reason for hiding this comment

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

I know we have a bit of cross-polination here, but seeing this makes me think we're cramming too much in core.

Could this live in its own app data_downloads or something like that? (naming is hard, especially on a Friday afternoon!)

)

# Block type names for table blocks in SectionContentBlock
TABLE_BLOCK_TYPES: frozenset[str] = frozenset(
Copy link
Contributor

Choose a reason for hiding this comment

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

question: should this leave in core blocks? locality of behaviour and all that (ref: SectionContentBlock)

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.

3 participants