Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use model error_messages when available#3435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lovelydinosaur merged 1 commit intoencode:masterfromstianjensen:unique-error
Sep 24, 2015

Conversation

@stianjensen
Copy link
Contributor

In the automatically applied UniqueValidator, use the error message from
error_messages defined in the model instead of the generic default
UniqueValidator message.

Thisfixes#2878.

In the automatically applied UniqueValidator, use the error message fromerror_messages defined in the model instead of the generic defaultUniqueValidator message.Thisfixesencode#2878.
@lovelydinosaur
Copy link
Contributor

Seems reasonable.

lovelydinosaur added a commit that referenced this pull requestSep 24, 2015
Use model error_messages when available
@lovelydinosaurlovelydinosaur merged commit509c54d intoencode:masterSep 24, 2015
@stianjensenstianjensen deleted the unique-error branchSeptember 24, 2015 12:20
unique_error_message=model_field.error_messages.get('unique',None)
ifunique_error_message:
unique_error_message=unique_error_message% {
'model_name':model_field.model._meta.object_name,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

django usescapfirst forverbose_name would such change be accepted?

egoag reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Most probably yup! (Could you point out an example ofexactly where/what first tho?)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm not sure what you would like to see. Is itthis?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Perfect, yup. If you do choose to submit a fix for this it'll also be worth double checking if there's any other errors messages where we should also be doingcapfirst(opts.verbose_name).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

can it filter OneToOneField?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@twins1040twins1040twins1040 left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.3.0 Release

Development

Successfully merging this pull request may close these issues.

error_messages on serializer fields should also be used by validators.

4 participants

@stianjensen@lovelydinosaur@ar45@twins1040

[8]ページ先頭

©2009-2025 Movatter.jp