Skip to content

fix(preferences): validate home_currency against currency choices - #297

Open
fjen wants to merge 1 commit into
coda-oa:developfrom
fjen:fix/currency-choices
Open

fix(preferences): validate home_currency against currency choices#297
fjen wants to merge 1 commit into
coda-oa:developfrom
fjen:fix/currency-choices

Conversation

@fjen

@fjen fjen commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

GlobalPreferences.home_currency was not validated at all and had max_length of 255. It was possible to set it to arbitrary values. We have a set of fixed currency codes with 3 chars.

This adds Currency.choices() that can be used elsewhere. The global prefs now also use the SelectSearchWidget.

Added migration and fallbacks.

@fjen fjen added the bug Something isn't working label Aug 31, 2026
- add Currency.choices() mapping codes to "CODE - Name" labels and use
  it in currency_field()
- constrain GlobalPreferences.home_currency via model choices and the
  searchable currency_field() dropdown; drop the widget override
- narrow column to varchar(3); migration 0012 resets stored values that
  cannot be a valid ISO code to EUR before narrowing
- get_home_currency() falls back to EUR for unparseable stored values
@fjen
fjen force-pushed the fix/currency-choices branch from 34f32f7 to e5a01d4 Compare August 31, 2026 15:36
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant