Code

Opened 6 years ago

Closed 3 years ago

#6737 closed New feature (wontfix)

Add Field default_error_messages feature to Forms class

Reported by: nicklane Owned by: nobody
Component: Forms Version: master
Severity: Normal Keywords:
Cc: daemondazz Triage Stage: Design decision needed
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I found it was useful to have the same default_error_messages dict feature that exists in Field classes, with Form classes too. This allows you to easily override the error messages shown by form validation, or change the messages by subclassing.

Attachments (1)

forms-error-messages.patch (3.4 KB) - added by nicklane 6 years ago.

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by nicklane

comment:1 Changed 6 years ago by nicklane

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

comment:2 Changed 6 years ago by jacob

  • Triage Stage changed from Unreviewed to Design decision needed

comment:3 Changed 5 years ago by daemondazz

  • Cc daemondazz added

comment:4 Changed 3 years ago by julien

  • Type set to New feature

comment:5 Changed 3 years ago by julien

  • Severity set to Normal

comment:6 Changed 3 years ago by carljm

  • Easy pickings unset
  • Resolution set to wontfix
  • Status changed from new to closed
  • UI/UX unset

Fields use a default_error_messages dict because they are built-in Django code that raises errors, and its useful for users to have a sane way to customize those messages.

Django's built-in Form classes don't raise any errors themselves. User forms that raise errors can use whatever technique they want for allowing subclasses to easily modify their error messages; Django doesn't need to dictate a particular method.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.