Opened 3 years ago

Closed 3 years ago

#18102 closed Cleanup/optimization (fixed)

fr localflavor : force min and max length

Reported by: mothsART Owned by: nobody
Component: contrib.localflavor Version: 1.3
Severity: Normal Keywords: fr localflavor
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

on fr localflavor, i think the best way is to force min and max length on form field.

Attachments (1)

Django-1.3.1_localflavor_forms.patch (1.5 KB) - added by mothsART 3 years ago.

Download all attachments as: .zip

Change History (6)

Changed 3 years ago by mothsART

comment:1 Changed 3 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Why do you think it would be better? The validators for these fields already enforce the length.

comment:2 Changed 3 years ago by charettes

Correct me if I'm wrong but I think setting the max_length option adds an html maxlength attribute to the field which might be interesting but specifying min_length doesn't add anything useful here.

comment:3 Changed 3 years ago by claudep

  • Has patch set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

No Simon, you are not wrong. So let's accept it on the base that max_length might be useful for constructing the widget.

comment:4 Changed 3 years ago by mothsART

charettes (Simon) : html5 minLength provides the input argument.
While Django does used it yet, i feel good to make explicit...not necessarily required.

In my patch, i think the key element is to use CharField instead of Field for at least benefit from "max" and "min_length".

Ergonomically, I think that a user always prefers a frame imposed as a false freedom.
In our case, if the validator strength size, why would it be possible to have a longer field?

comment:5 Changed 3 years ago by Claude Paroz <claude@…>

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

In [47da7b7a9aefce66fa2c54833b5ba308781fc95e]:

Fixed #18102 -- Defined min/max_length on French localflavor form fields

Thanks mothsART for the report and the initial patch.

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