Opened 13 years ago

Closed 10 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, Michael Warkentin, 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 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Aymeric Augustin, 13 years ago

Component: FormsDatabase layer (models, ORM)

comment:3 by Marboni, 12 years ago

Are you guys plan to fix it in 1.4?

comment:4 by Aymeric Augustin, 12 years ago

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 by anonymous, 11 years ago

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 by Glyn Jackson, 10 years ago

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 by Glyn Jackson, 10 years ago

Version: 1.31.6

comment:8 by loic84, 10 years ago

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 by Tim Graham, 10 years ago

Needs documentation: set

Looks reasonable to me, but needs documentation.

comment:10 by loic84, 10 years ago

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

comment:11 by loic84, 10 years ago

Needs documentation: unset

Added documentation to the PR.

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

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