Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#24341 closed Cleanup/optimization (fixed)

Subclasses of django.contrib.postgres.forms.ranges.BaseRangeField should have more specific error messages

Reported by: Alexey Boriskin Owned by: Chris Foresman
Component: contrib.postgres Version: 1.8alpha1
Severity: Normal Keywords: i18n, postgres 1.8-beta
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

I was translating new contrib.postgres strings on transifex and noticed that all range fields use the same error message: "Enter two valid values".
I suppose it may be misleading for the user of those fields, as the type of those values is not explicitly specified.
I propose that each subclass of BaseRangeField - IntegerRangeField, FloatRangeField, etc. to have its own 'invalid' error message - e.g. "Enter two valid integers", "Enter two valid dates", etc.

Change History (9)

comment:1 by Tim Graham, 10 years ago

Cc: Marc Tamlyn added

Any opinion on this, Marc?

comment:2 by Marc Tamlyn, 10 years ago

I don't mind, seems like it's probably a good idea. There aren't any technical challenges. The same code of the ValidationError should be kept across all the fields.

comment:3 by Tim Graham, 10 years ago

Cc: Marc Tamlyn removed
Easy pickings: set
Keywords: 1.8-beta added
Triage Stage: UnreviewedAccepted
Type: New featureCleanup/optimization

comment:4 by Chris Foresman, 10 years ago

Owner: set to Chris Foresman
Status: newassigned

I'll take a crack at this.

comment:5 by Chris Foresman, 10 years ago

Tim,

Should these just be "integers", "floats", or something more humane? E.g. "Enter two valid whole numbers"?

comment:6 by Chris Foresman, 10 years ago

Has patch: set

comment:7 by Tim Graham, 10 years ago

Triage Stage: AcceptedReady for checkin

comment:8 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 1d1d5d1c315e0e58f02a7f2a07b56ed20b09c087:

Fixed #24341 -- Added specific error messages to RangeField subclasses

comment:9 by Tim Graham <timograham@…>, 10 years ago

In 3207fcd0a0b90e677b1bb5cf662dee21c659adab:

[1.8.x] Fixed #24341 -- Added specific error messages to RangeField subclasses

Backport of 1d1d5d1c315e0e58f02a7f2a07b56ed20b09c087 from master

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