Opened 12 years ago

Closed 9 years ago

#16192 closed New feature (fixed)

Make unique_together error messages in ModelForms customizable

Reported by: Leah Culver Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Oroku Saki, tinodb, mwarkentin, Matthew Schick, Andrew Godwin, loic@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


This is related to ticket #8913 and Google groups discussion:

Allow developers to specify a unique_together custom error_message on their model. This is more difficult than #8913 since the syntax is less obvious. Should there be something in the Meta?

Change History (12)

comment:1 Changed 12 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted

comment:2 Changed 12 years ago by Aymeric Augustin

Component: FormsDatabase layer (models, ORM)

comment:3 Changed 11 years ago by Marboni

Are you guys plan to fix it in 1.4?

comment:4 Changed 11 years ago by Aymeric Augustin

This ticket hasn't gotten much attention. Apparently, no one cares enough to write a patch. Until someone does, the feature won't be implemented.

comment:5 Changed 10 years ago by anonymous

I think it should get the attention it deserves. Providing the checking of the fields without allowing to use a proper error message is like buying a car which an alarm but without a door.

comment:6 Changed 9 years ago by Glyn Jackson

More attention please! Are there any plans for this yet? I'm not confident enough yet to submit a patch but would like to work on this with someone.

comment:7 Changed 9 years ago by Glyn Jackson

Version: 1.31.6

comment:8 Changed 9 years ago by loic84

Cc: loic@… added
Has patch: set
Version: 1.6master

@glynjackson, I've had a go at this, could you please check if it solves your issue?

comment:9 Changed 9 years ago by Tim Graham

Needs documentation: set

Looks reasonable to me, but needs documentation.

comment:10 Changed 9 years ago by loic84

@timo what kind of documentation do you have in mind? Just an entry in the release notes?

comment:11 Changed 9 years ago by loic84

Needs documentation: unset

Added documentation to the PR.

comment:12 Changed 9 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 8847a0c601e4261823b1726b2db73eec2ac17940:

Fixed #16192 -- Made unique error messages in ModelForm customizable.

Overriding the error messages now works for both unique fields, unique_together
and unique_for_date.

This patch changed the overriding logic to allow customizing NON_FIELD_ERRORS
since previously only fields' errors were customizable.

Refs #20199.

Thanks leahculver for the suggestion.

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