Commit Graph

6156 Commits

Author SHA1 Message Date
Tomasz Rydzyński
4e634ca068 Add error codes to ValidationError
This change addresses use cases that require more information about reported
validation errors. Currently for each error that REST Framework reports users
get only that error's message string. The message can be translated so there's
no good way to recognize programmatically what sort of an error it is.

When building an API that is supposed to return error codes, I've found it very
limiting. For example, I was supposed to differentiate between missing fields
and invalid arguments.

This commit introduces proper error codes handling to the ValidationError.

ValidationError can hold a single error itself (text), a list of those, or a
dictionary mapping errors to fields. Error code is only meaningful for a single
error, and I've added assertions to check for proper usage.

To help with my development, I've added a setting that makes error code a
mandatory argument. Thanks to this, I was able to correct all uses of
ValidationError across the code.

To maintain backward compatibility, I'm not passing error codes when building
compound errors (e.g. a dictionary with all validation errors). However, users
(me) can now monkey patch ValidationError.build_detail method, to store the
codes.
2015-11-09 20:19:17 +01:00
Tom Christie
af5474f9b3 Merge pull request #3539 from tomchristie/funding
Funding
2015-10-23 16:54:21 +01:00
Tom Christie
eeff5a1709 Merge branch 'master' into funding 2015-10-23 16:27:30 +01:00
Tom Christie
84e9013417 Merge pull request #3531 from tomchristie/version-3.3
Version 3.3
2015-10-23 16:24:08 +01:00
Tom Christie
b2fb0deb34 Add latest item to the release notes 2015-10-23 16:15:44 +01:00
Tom Christie
0fb1ebcfcf Remove unused import 2015-10-23 16:07:48 +01:00
Tom Christie
9a78db2707 Merge pull request #3536 from jpadilla/filepathfield-mapping
Map all supported FilePathField options
2015-10-23 15:23:26 +01:00
José Padilla
d64bfef56a Map all supported FilePathField options 2015-10-23 10:08:29 -04:00
auvipy
fa93d79026 removed south_migrations directory 2015-10-23 10:00:01 -04:00
auvipy
b71e6b596f removed south migrations 2015-10-23 10:00:00 -04:00
Tom Christie
ff285cfe66 TODO placeholder in release announcement 2015-10-22 15:15:55 +01:00
Tom Christie
7bfc420dc9 Add release notes, drop deprecated test 2015-10-22 15:11:10 +01:00
Tom Christie
4e7cc68ec9 Link tweaks 2015-10-22 14:42:35 +01:00
Tom Christie
ae852b2be4 Tweak links 2015-10-22 14:08:19 +01:00
Tom Christie
07b23c8685 Add version 3.3 to the docs index 2015-10-22 14:06:55 +01:00
Tom Christie
cf33008571 Release notes etc 2015-10-22 14:05:52 +01:00
Tom Christie
c53c9eddfe Merge pull request #3315 from tomchristie/filters
First pass at HTML rendering for filters
2015-10-22 11:42:35 +01:00
Tom Christie
0c6d46729c Docs on the filter HTML interface 2015-10-22 11:37:27 +01:00
Tom Christie
6305ae8916 Merge pull request #3475 from tomchristie/forms-api
Forms API
2015-10-22 09:59:57 +01:00
Xavier Ordoquy
71338ddd3f Merge pull request #3528 from peterdemin/patch-1
Fixed grammar in docs for "Writable nested serializers"
2015-10-21 15:35:23 +02:00
Peter Demin
423e0de358 Fixed grammar in docs for "Writable nested serializers" 2015-10-21 09:33:34 -04:00
Tom Christie
58faebcdb1 Merge pull request #3526 from likeon/fk-to_field
Added support for the to_field on ForeignKey fields
2015-10-21 14:00:32 +01:00
likeon
322bda8159 Added support for the to_field on ForeignKey fields 2015-10-21 15:33:18 +03:00
José Padilla
825e67454d Merge pull request #3527 from potpath/patch-2
Fix broken link caused by case sensitivity
2015-10-21 08:03:07 -04:00
potpath
9634cea474 Fix broken link caused by case sensitivity 2015-10-21 18:43:07 +07:00
Tom Christie
c68d932ac9 Merge pull request #3525 from tomchristie/django-19-beta
Test against Django 1.9 beta
2015-10-20 11:02:30 +01:00
Tom Christie
5b5d6f1d4b Test against Django 1.9 beta 2015-10-20 10:53:45 +01:00
Tom Christie
0d1637d666 Minor docs update 2015-10-20 10:49:39 +01:00
José Padilla
4e24374c14 Merge pull request #3521 from agconti/master
docs(third-party-resources): added `cookiecutter-django-rest` to misc third party resources
2015-10-19 21:35:31 -04:00
Tom Christie
34eb18b498 Merge branch 'master' into filters
Conflicts:
	rest_framework/compat.py
	rest_framework/filters.py
2015-10-19 13:14:42 +01:00
Tom Christie
86470b7813 Merge pull request #3517 from thedrow/feature/set-and-dict-literals
Replaced all dict and set conversions from lists to dict and set literals
2015-10-19 09:46:36 +01:00
agconti
6757da5aab docs(third-party-resources): added cookiecutter-django-rest to misc third party resources 2015-10-18 20:13:09 -04:00
Omer Katz
2e178bc970 Replaced all dict and set conversions from lists to dict and set literals. 2015-10-17 12:00:11 +03:00
José Padilla
df025f3d98 Merge pull request #3515 from Photonomie/doc-typo
Missing the `source=` keyword for the URLField parameter
2015-10-16 15:41:12 -04:00
Pierre Dulac
dc72fb4746 Missing the source= keyword for the URLField parameter 2015-10-16 19:43:00 +02:00
Tom Christie
c94b354efa Merge pull request #3509 from jpadilla/textfield-max-length
Map TextField max_length to CharField
2015-10-16 12:31:26 +01:00
José Padilla
a1dad503cf Map TextField max_length to CharField 2015-10-16 07:17:33 -04:00
Xavier Ordoquy
1b4a41cb80 Merge pull request #3502 from auvipy/master
removed south migrations
2015-10-15 10:41:07 +02:00
auvipy
4db2501399 removed south_migrations directory 2015-10-15 14:17:56 +06:00
auvipy
392df94693 removed south migrations 2015-10-15 14:16:35 +06:00
Xavier Ordoquy
5570db402f Merge pull request #3501 from ztanner/patch-1
Various typo/grammar fixes
2015-10-15 08:21:22 +02:00
Zack Tanner
6fe021eea7 Various typo fixes 2015-10-14 19:09:11 -07:00
José Padilla
ad001143c9 Merge pull request #3498 from Ins1ne/feature/admin_renderer_jquery
fix typo for adding jquery string in AdminRenderer
2015-10-14 09:06:52 -04:00
Aider Ibragimov
79008ea210 fix typo for adding jquery string in AdminRenderer 2015-10-14 15:56:26 +03:00
Tom Christie
90247afe29 Docs on Forms API 2015-10-12 21:14:58 +01:00
Xavier Ordoquy
68312cb0bc Merge pull request #3488 from demokrates/patch-1
Update versioning.md
2015-10-12 10:25:39 +02:00
demokrates
47c9d2a4d3 Update versioning.md
Changed settings attribute 'VERSION_PARAMETER' --> to 'VERSION_PARAM'.
2015-10-12 10:10:08 +02:00
Xavier Ordoquy
fa1cfae991 Merge pull request #3485 from dulmandakh/dulmandakh-guardian-check-installed-apps
Update compat.py
2015-10-09 08:13:42 +02:00
Dulmandakh
431ac45168 Update compat.py
try to import guardian if it's in INSTALLED_APPS
2015-10-09 11:03:19 +08:00
Tom Christie
85cd717ec0 Merge pull request #3481 from nryoung/fix-codecov
Fix codecov on Travis CI
2015-10-08 19:47:33 +01:00