Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

527
Views
Django rest framework: How to change error response format globally

All the error messages return from django default validators ends with a dot (.). Is there anyway to remove that last dot from all messages globally.

Or, If someone help me to find a way to catch these error returning function, I can trim the last dot if exists in that section.

Sample error messages.

{
  "email": [
    "This field may not be blank."
  ]
}


{
  "email": [
    "Enter a valid email address."
  ]
}
about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You can use Restframework's exception handler. Please have a look.

about 4 years ago · Santiago Trujillo Report

0

If you want to change all of them, you should override the field's default messages somewhere in the application initialization:

serializers.CharField.default_error_messages['blank'] = 'This field may not be blank'

For example, the blank message can be found here

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!