Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#19015 closed Bug (fixed)

Slovenian L10N - date field validation does not work for hidden fields

Reported by: bmihelac Owned by: nobody
Component: Internationalization Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When DateInput has HiddenInput widget, it renders value by converting date to string This produces iso-8601 (YYYY-MM-DD) format.

Because iso-8601 format is not stated in slovenian flavor DATE_INPUT_FORMATS, validation will fail if USE_L10N=True and hidden date field exists.

This issue applies to some other locales as well:

ack --py --files-without-matches  '%Y-%m-%d' conf/locale/

Change History (9)

comment:1 Changed 3 years ago by bmihelac

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from Slovenian l10n does not work with hidden fields to Slovenian L10N - date field validation does not work for hidden fields

comment:2 Changed 3 years ago by bmihelac

Patch for slovenian language is available:
https://github.com/django/django/pull/390

comment:3 Changed 3 years ago by claudep

  • Component changed from contrib.localflavor to Internationalization
  • Triage Stage changed from Unreviewed to Accepted

I also think that we should consider adding iso formats by default, then remove them from the formats.py file.

comment:4 Changed 3 years ago by claudep

  • Has patch set

New pull request which solves the issue by automatically adding ISO input formats to all localized input formats.

https://github.com/django/django/pull/440

comment:5 Changed 3 years ago by bmihelac

This pull request looks great to me. Agree it is better to implicitly add ISO formats.

comment:6 Changed 2 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 349c4c37f8be401592793b47a591ff079c4a7fbb:

Fixed #19015 -- Add ISO input formats to all formats

comment:7 Changed 2 years ago by Claude Paroz <claude@…>

In 90d3af380e8efec0301dd91600c6686232de3943:

Fixed #19015 -- Removed ISO formats from localized formats.py

ISO formats are automatically appended to the list of input
formats. Kept only when it is specified in first position, as it
has a special meaning in localize_input.
Thanks Bojan Mihelac for the report.

comment:8 Changed 2 years ago by Claude Paroz <claude@…>

In ae549cc1dd8740f5463739602967f6595a1b3ce9:

Fixed #19015 -- Removed ISO formats from localized formats.py

ISO formats are automatically appended to the list of input
formats. Kept only when it is specified in first position, as it
has a special meaning in localize_input.
Thanks Bojan Mihelac for the report.

Backport of 90d3af380 from master.

comment:9 Changed 2 years ago by Claude Paroz <claude@…>

In 1b93499849f497af405de113355681e3af68d50b:

[1.5.x] Fixed #19015 -- Add ISO input formats to all formats

Backport of 349c4c37f8 from master.

Note: See TracTickets for help on using tickets.
Back to Top