Commit Graph

559 Commits

Author SHA1 Message Date
José Padilla
d64bfef56a Map all supported FilePathField options 2015-10-23 10:08:29 -04:00
Tom Christie
7bfc420dc9 Add release notes, drop deprecated test 2015-10-22 15:11:10 +01:00
José Padilla
a1dad503cf Map TextField max_length to CharField 2015-10-16 07:17:33 -04:00
Tom Christie
dad207de66 Don't attempt to test dicts (unordered) 2015-09-28 17:41:09 +01:00
Tom Christie
ec8098b7e2 Work around 2.x/3.x json.dumps() return type fuzziness 2015-09-28 17:32:36 +01:00
Tom Christie
10dbf1316f Added JSONField. Closes #3170. 2015-09-28 17:25:52 +01:00
Tom Christie
c64896c849 More cleanup of browser overrides 2015-09-28 15:33:55 +01:00
Tom Christie
d7142e23ac Merge branch 'master' into remove-content-overriding 2015-09-28 15:15:50 +01:00
Tom Christie
2d0b54e263 Merge branch 'drop-django-16' oft https://github.com/carltongibson/django-rest-framework into carltongibson-drop-django-16
Conflicts:
	docs/topics/release-notes.md
2015-09-28 11:17:48 +01:00
Tom Christie
ca8313aeac Merge branch 'master' into version-3.3
Conflicts:
	docs/topics/release-notes.md
2015-09-28 10:57:14 +01:00
Stian Jensen
62c000bc12 Use model error_messages when available
In the automatically applied UniqueValidator, use the error message from
error_messages defined in the model instead of the generic default
UniqueValidator message.

This fixes #2878.
2015-09-23 15:20:44 +02:00
paolopaolopaolo
7640bfea9e Add assert statement to .save() method in Serializer:
- Asserts that `_data` does not exist when calling `.save()`
2015-09-22 11:49:51 -07:00
paolopaolopaolo
134f5fa4bc Fixes #3265 (now with Test Case)
- Added test_data_access_before_save_raises_error test
2015-09-22 11:40:19 -07:00
Carlton Gibson
45ace5010e Remove OrderedDict fallback 2015-09-22 16:35:38 +02:00
Carlton Gibson
0b34408172 Remove unittest.skipUnless 2015-09-22 16:24:22 +02:00
Carlton Gibson
6e86a53c92 Remove apps.get_model fallback
* Corrects presumed logic error in `ResolveModelWithPatchedDjangoTests`
2015-09-22 16:14:45 +02:00
Carlton Gibson
68c88e180f Remove ContentType import fallback 2015-09-22 15:55:39 +02:00
Alexey Boriskin
0155a44aac Typo in test method name 2015-09-22 12:13:01 +03:00
Carlton Gibson
25de8c960f Remove Django 1.5 get_model_name fallback 2015-09-21 20:10:31 +02:00
Xavier Ordoquy
f2c65512c6 Merge pull request #3415 from adamsc64/issue_2761
Fixed #2761 - ListField truncation on HTTP PATCH
2015-09-21 13:06:44 +02:00
Christopher Adams
cb42b995fa Proof of bug #2761
- When not submitting key for list fields or multiple choice, partial
  serialization should result in empty state (key not there), not an
  empty list.
2015-09-19 10:17:57 -04:00
Tom Christie
b8ebe29844 Import sorting 2015-09-17 16:40:47 +01:00
Tom Christie
343fd5ec3d Merge branch 'canassa-method-not-allowed-not-raised' into remove-content-overriding 2015-09-17 16:39:30 +01:00
Tom Christie
66e372200f Merge branch 'method-not-allowed-not-raised' of https://github.com/canassa/django-rest-framework into canassa-method-not-allowed-not-raised 2015-09-17 16:38:42 +01:00
Tom Christie
4b4130e8b2 Fix request cloning, so method becomes set 2015-09-17 16:34:03 +01:00
Tom Christie
a3067bea55 Merge branch 'master' into version-3.3 2015-09-17 16:24:46 +01:00
Tom Christie
566812ac0b Remove method and content overriding 2015-09-17 15:17:29 +01:00
Steven Loria
284f9faa07 Correctly handle [] and {} as invalid inputs to BooleanField 2015-09-11 23:12:18 -04:00
Xavier Ordoquy
aa48182686 Add test coverage on allow_empty for nested serializers. 2015-09-07 23:11:01 +02:00
raphaelmerx
b9782b6850 DurationField accepts integers 2015-09-02 16:47:50 -07:00
Tom Christie
f87573ffa3 Merge pull request #3345 from jpadilla/fields
Update ModelSerializer 'fields'/'exclude'/'__all__' behavior
2015-08-28 14:57:05 +01:00
Tom Christie
7560e8381f Drop unused patterns 2015-08-28 10:53:44 +01:00
Tom Christie
6fa534f214 Fix urlpatterns in test 2015-08-28 10:44:49 +01:00
Tom Christie
25c4c7f9fd Pep8 fix 2015-08-28 10:03:16 +01:00
Tom Christie
e70da5ac6b Compat for GenericForeignKey, GenericRelation 2015-08-28 10:03:08 +01:00
José Padilla
654e0e4527 Update ModelSerializer fields behavior 2015-08-27 13:09:08 -04:00
Tom Christie
4f27697467 Fix get_model import 2015-08-27 17:28:12 +01:00
Tom Christie
f691006f2c Resolve generic fields import 2015-08-27 17:16:19 +01:00
Tom Christie
48540f180a unittest compat fallback 2015-08-27 17:11:53 +01:00
Tom Christie
b271946b31 Merge pull request #3321 from tomchristie/empty-charfield-html
Resolve empty HTML charfield behavior.
2015-08-24 10:41:36 +01:00
Tom Christie
9ac646385f Resolve empty HTML charfield behavior. Closes #3318. 2015-08-24 10:13:16 +01:00
borzdyko
21d0e51831 Test for regex search filter 2015-08-21 18:23:39 +03:00
Tom Christie
0f77c27d34 Merge branch 'master' of https://github.com/callorico/django-rest-framework into callorico-master 2015-08-20 12:30:33 +01:00
José Padilla
8af366a732 Raise error when source= use on a child.
Closes #3292
2015-08-19 12:32:16 -04:00
Ollie Walsh
332c30afb9 Lint 2015-08-14 12:20:25 +01:00
Ollie Walsh
3d0292e1cd Do not ignore overridden View.get_view_name() in breadcrumbs 2015-08-14 12:16:57 +01:00
Tom Christie
18af181191 Fix boolean checkboxes setting to False. Closes #3258. Closes #2776. 2015-08-13 09:56:03 +01:00
James Beith
e9d9cb7011 Add tests for display_value 2015-08-10 12:19:46 +01:00
Ryan Kaneshiro
bc6bf7236b Add test to repro duplicate validation error
Using the ModelSerializer with a model containing a GenericIPAddressField
produces duplicated validation error messages.
2015-08-07 16:53:43 -07:00
Keryn Knight
08d60f5cc2 Refs #3235 - Test demonstrating a single value passed to ListField is lost. 2015-08-07 11:41:56 +01:00
Tom Christie
33d6d4a420 Test more types of behavior in test_iter_options 2015-08-06 12:30:26 +01:00
Tom Christie
24dec32e7a Added test_iter_options 2015-08-06 12:18:09 +01:00
Tom Christie
27ac5a3680 Support grouped choices 2015-08-06 11:43:03 +01:00
Tom Christie
95a1550388 Merge branch 'grouped-choices-fix' of https://github.com/maxpeterson/django-rest-framework into maxpeterson-grouped-choices-fix 2015-08-06 10:04:52 +01:00
Tom Christie
38a1b3ec6b Rationalize decimal logic. Closes #3222. 2015-08-06 09:51:00 +01:00
Cesar Canassa
60c17253ab Add test to check if a 415 status is returned for unsupported media types 2015-08-03 17:54:18 +02:00
Tom Christie
8d7c0a8474 Merge branch 'feature/filepathfield' of https://github.com/Ins1ne/django-rest-framework into Ins1ne-feature/filepathfield 2015-08-03 10:09:46 +01:00
Tom Christie
a543fae180 Merge pull request #2766 from delinhabit/allow-null-list-serializer
Modify subtle ChildSerializer(many=True, allow_null=True) behavior.
2015-07-31 10:11:21 +01:00
Tom Christie
e68d737825 Respect blank on many to many, and set allow_empty=False if it is not present. Closes #2804. 2015-07-30 17:03:08 +01:00
Tom Christie
4fd971e3e5 Update exception handler test in line with deprecations 2015-07-30 15:42:11 +01:00
Tom Christie
c203ca4c64 Deprecations 2015-07-30 15:26:42 +01:00
Tom Christie
c5a04a8516 Add test for nullable ChoiceField and blank HTML input. Closes #2623. 2015-07-27 13:51:03 +01:00
Ion Scerbatiuc
bbd44ae94b Updated the test cases based on the CR comments 2015-07-25 08:22:14 -07:00
Ion Scerbatiuc
085c3e8a2b Fixed python 2.6 compatibility 2015-07-25 08:10:15 -07:00
Ion Scerbatiuc
bf25a6ecbc Test case for using allow_null with many=True and a fix for it 2015-07-25 08:10:15 -07:00
Tom Christie
bdeb28944f Use RuntimeError, not AssertionError when guarding against direct View.queryset evalutation. Refs #3180. 2015-07-24 09:13:39 +01:00
Tom Christie
e05021c8c6 Guard against erronous direct .queryset evaluation in CBVs. 2015-07-23 17:17:18 +01:00
Tom Christie
d14bc3c4e1 Fix test cases for python3 2015-07-23 14:41:28 +01:00
Tom Christie
90fe0fb881 Errors in browsable API on error. Closes #3024. 2015-07-23 14:31:25 +01:00
Tom Christie
22631c73a7 Resolve assertion error with LimitOffsetPagination and erronous parameters. Closes #2920. 2015-07-23 12:41:35 +01:00
Aider Ibragimov
d845157983 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework into feature/filepathfield 2015-07-18 23:34:07 +03:00
Tom Christie
7b21336872 Rename model to play nice with Django 1.7. 2015-07-16 16:18:14 +01:00
Tom Christie
0b6eb4a881 Fix for Django 1.7 issue with long default verbose_name arguments on ChoiceField 2015-07-16 16:01:50 +01:00
Tom Christie
0ccb148183 Support QueryDict list arguments with ListField. Closes #3155. 2015-07-16 15:59:15 +01:00
Tom Christie
e14391e041 Fix for ModelSerializer ChoiceField with nonstandard args. Closes #3126. 2015-07-16 15:46:27 +01:00
Tom Christie
713333d354 Merge branch 'master' of github.com:tomchristie/django-rest-framework 2015-07-16 15:17:27 +01:00
Tom Christie
806b0b34da Include nested objects in metadata for OPTIONS. Closes #3156. Closes #2915. 2015-07-16 15:17:18 +01:00
Tom Christie
264d423493 Added allow_empty flag for ListField, ListSerializer, ManyRelation, MultipleChoiceField. 2015-07-16 13:51:15 +01:00
Venelin Stoykov
73c0ebc2d5 Test for #3153 2015-07-16 15:40:41 +03:00
Tom Christie
cde7154c59 Runtests should not suppress stdout. In the context of a web app only serves to hide erronous print statements. 2015-07-16 11:50:22 +01:00
Tom Christie
d231f36588 Support default values being used for empty HTML fields. Closes #3130. 2015-07-16 11:47:40 +01:00
Tom Christie
132eab7bbd Raise helpful error when erronously including nested data in multipart post requests with test client. Closes #2919. 2015-07-14 14:49:44 +01:00
Juan Gutierrez
2887fc4a0b update QueryDict initialization to satisfy older versions of Django 2015-07-08 08:25:12 -04:00
Juan Gutierrez
35db2b142f remove FakeMultiDict definition in nested serializer tests and replace with django QueryDict 2015-07-08 08:19:42 -04:00
Juan Gutierrez
b0c5f9db2f allow a non-required nested serializer to validate correctly when receiving multipart data 2015-07-03 12:28:48 -04:00
Max Peterson
56b3f19605 Add support for grouped choices.
This also adds support for mixing single and paired choices:
```
[
    ('poor', 'Poor quality'),
    'medium',
    ('good', 'Good quality'),
]
```
2015-07-03 12:27:01 +01:00
Julien Syx
2b979d4356 Adding recursion on child of List Field 2015-07-02 14:15:43 +02:00
Tom Christie
fb4233736f Empty settings should also be coerced to lists. Closes #3087. 2015-07-02 10:28:46 +01:00
Tyler Redzko
af08c70242 Update extra_kwargs on model serializer
Ensures that the 'read_only' and 'required' keys from `extra_kwargs` are
retained when present. Closes #3091.
2015-07-01 10:10:18 -04:00
José Padilla
7351a3f6ca Sort imports with isort 2015-06-25 16:55:51 -04:00
José Padilla
83c9136c90 Cleanup import following PEP 8 style guide 2015-06-25 16:10:17 -04:00
José Padilla
d6e30c75ff Add test and fix for #2704 2015-06-25 09:35:36 -04:00
Tom Christie
39ece9bee0 Support allow_blank=False with trim_whitespace=True. 2015-06-24 13:32:54 +01:00
Tom Christie
8329411cc3 Merge pull request #2539 from donewell/permission-detail
add message to custom permission
2015-06-24 11:32:02 +01:00
homm
9bc0319ff4 Revert tests 2015-06-23 19:02:05 +03:00
homm
b01e91eb71 test custom cursor format 2015-06-23 18:09:17 +03:00
homm
b3716ccb91 make MockObject, MockQuerySet and ExamplePagination visible outside of setup 2015-06-23 18:07:32 +03:00
Tom Christie
15a386e85d Merge pull request #3045 from paxnovem/issue_3042
Fixed many=False issue on related fields
2015-06-22 15:40:59 +01:00
Markus Korn
aa1ad4fb64 test_requests TestSecure: skip tests for django versions where the secure
argument is not available
2015-06-22 14:28:09 +02:00
Markus Korn
d86e494e86 test_quests: added TestSecure for the emulation of secure connections in test cases 2015-06-22 14:04:46 +02:00
Brian Grohe
d24990ece2 Fixed many=False issue in related fields
Added check to pop many from kwargs before passing to __init__
Fixed my lint issue from the previous commit
2015-06-17 13:48:34 -04:00
Brian Grohe
79736e516a Added failing test case
Adding failing test case when many=false is explicitly defined

https://github.com/tomchristie/django-rest-framework/issues/3042
2015-06-17 13:18:50 -04:00
Xavier Ordoquy
139ba7adeb Merge pull request #3006 from osantana/master
Handle invalid characters in "Authorization: token ..." headers
2015-06-16 22:40:15 +02:00
José Padilla
0be6d87fac Fix versioning urls 2015-06-15 16:51:37 -04:00
José Padilla
7f0acbd5a5 Merge pull request #3026 from linovia/feature/format_suffix_patterns_and_trailing_slash
`format_suffix_patterns` is applied before the trailing slash.
2015-06-15 16:38:12 -04:00
Thomas Stephenson
a1e0bae9da Custom serialization of PrimaryKeyRelatedField values
Adds a 'pk_field' parameter which can be used to proxy serialization and
deserialization of arbitrary primary key values.
2015-06-15 04:43:49 +10:00
Kevin Brown
b0889446a5 Merge pull request #3027 from linovia/feature/url_patterns_removal
Remove `django.conf.urls.pattern`
2015-06-11 16:40:40 -04:00
Xavier Ordoquy
bfd7219352 Define the urlpatterns as a list of `url().... 2015-06-11 01:01:47 +02:00
Xavier Ordoquy
9f1805f2f0 Removed unused imports. 2015-06-11 00:51:33 +02:00
Xavier Ordoquy
1e51230f1b Remove django.conf.urls.pattern as it'll be removed in Django 2.0 2015-06-11 00:45:23 +02:00
Xavier Ordoquy
fb2c09f6ae Remove unused patterns import. 2015-06-11 00:36:37 +02:00
Xavier Ordoquy
e7e5946c2e format_suffix_patterns is applied before the trailing slash. 2015-06-11 00:32:05 +02:00
hellysmile
cbfce93129 Fitx TestCase due Django interals. 2015-06-08 18:15:31 +03:00
hellysmile
b015ae99e6 Inline @transaction.non_atomic_requests for Django<1.6. 2015-06-08 07:39:08 +03:00
hellysmile
c292b3d132 Fix set_rollback on @transaction.non_atomic_requests. 2015-06-08 07:10:57 +03:00
Ash Hoover
35c28a2a71 Include correct limits in LimitOffsetPagination link urls 2015-06-05 08:56:33 -07:00
Xavier Ordoquy
dee5fb5647 Merge remote-tracking branch 'reference/master' into feature/ipaddress-fix
Conflicts:
	docs/api-guide/fields.md
2015-06-04 14:21:33 +01:00
Osvaldo Santana Neto
7ae71deb84 Handle invalid characters in headers 2015-06-03 14:55:34 -03:00
Xavier Ordoquy
0c66c7cfa6 Merge pull request #3000 from linovia/ovangle/uuid_format2
Add 'format' argument to UUIDField
2015-06-03 12:32:23 +01:00
Xavier Ordoquy
734bf3cfe6 Merge pull request #2981 from jannon/fix-model-serializer-metadata
Read-Only RelatedField Metadata Failure Test and Fix
2015-06-02 15:09:05 +01:00
Jannon Frank
a97c989248 fix read_only related field metadata 2015-06-02 00:40:00 -07:00
Nicolas Delaby
34dc98e8ad improve wording 2015-06-02 09:19:58 +02:00
Nicolas Delaby
8ad38208a1 more assertions make the test more readable 2015-06-02 09:19:58 +02:00
Nicolas Delaby
d1371cc949 Use post instead of get for sanity of use-case. 2015-06-02 09:19:58 +02:00
Nicolas Delaby
c2d2417237 Tell default error handler to doom the transaction on error
if `ATOMIC_REQUESTS` is enabled.
2015-06-02 09:19:58 +02:00
Xavier Ordoquy
f8eacc5bc0 Merge pull request #2993 from linovia/bug/2894
MultipleChoiceField empties incorrectly on a partial update using multipart/form-data (#2894)
2015-06-01 17:48:20 +01:00
Xavier Ordoquy
14055dd3f4 Merge pull request #2989 from ticosax/duration-field
Add DurationField
2015-06-01 17:38:57 +01:00
Nicolas Delaby
f701ecceb7 Add DurationField 2015-06-01 18:20:53 +02:00
Xavier Ordoquy
94e2d3ca61 Test case upgrade to use partial data 2015-06-01 16:13:12 +01:00
Xavier Ordoquy
989c08109b Failing test case for #2894 2015-06-01 16:04:05 +01:00
Tom Christie
0fdaa0dbba Merge pull request #2992 from linovia/feature/clean_mock_html_dir
Remove an extra MockHTMLDict definition.
2015-06-01 15:54:09 +01:00
Xavier Ordoquy
2f524ec1a3 Remove an extra MockHTMLDict definition. 2015-06-01 15:46:27 +01:00
Xavier Ordoquy
e3f856ff1d Merge pull request #2975 from sheppard/read-only-nested
can't create nested serializers for unique_together relations
2015-06-01 12:01:40 +01:00
S. Andrew Sheppard
4a3c844b7f flake8 2015-05-28 08:29:15 -05:00
S. Andrew Sheppard
0b8b288be5 python2 compat 2015-05-28 08:20:43 -05:00
S. Andrew Sheppard
805a915e7c can't nest unique_together relations 2015-05-27 21:06:57 -05:00
Michał Hernas
069ea31cfb Added test ensuring DecimalField accepts 2E+2 as 200 and validates
decimal place correctly.
2015-05-18 16:42:24 +02:00
David Sanders
8e84a9f6d0 Allow invalid outputs to pass through to_representation() for ChoiceField & MultipleChoiceField 2015-05-15 18:59:10 +10:00
Tom Christie
ea1145c5aa Merge pull request #2905 from ticosax/django-object-perm-get_queryset
Allow DjangoObjectPermissions to use views that define get_queryset
2015-05-13 13:39:59 +01:00
Nicolas Delaby
031ac2a292 Allow DjangoObjectPermissions to use views that define get_queryset 2015-05-13 14:26:44 +02:00
Tom Christie
abcd6f2b9e Merge pull request #2869 from ryangallen/datefield
DateField to_representation can handle str and empty values. Fixes #2656, #2687.
2015-05-01 16:33:43 +01:00
Tom Christie
2394577dc2 Merge pull request #2757 from ekiourk/2630/Raise-exception-when-ModelSerializer-used-with-abstract-model
Raise error when ModelSerializer used with abstract model
2015-04-27 14:47:32 +01:00
Ryan Allen
cbea03c85b DateField to_representation can handle str and empty values. Fixes #2656, #2687. 2015-04-23 19:31:46 -05:00
Nicolas Delaby
63511c03d0 Check AcceptHeaderVersioning with content negotiation in place 2015-04-23 14:19:39 +02:00
Nicolas Delaby
6f66798ad3 Prevent empty querysets to raises AssertionError. 2015-04-22 11:13:09 +02:00
Nicolas Delaby
c2e536bfda Tell DjangoModelPermissions to rely on get_queryset first. 2015-04-22 10:18:30 +02:00
Ryan Allen
1f10a39d31 Match IntegerField validation with Django's, preventing decimal values being stored as ints, fixes #2835.
Match IntegerField validation with Django IntegerField, prevents decimal values being stored as ints, fixes #2835
 On branch master
2015-04-20 11:03:05 -04:00
Thomas Stephenson
236b731072 Add 'format' argument to UUIDField
To allow serializations to control the representation format of a
UUID value
2015-04-12 22:07:25 +10:00
Simon Charette
87208021e2 Metadata should detect null boolean field type. 2015-03-24 21:31:35 -04:00
Ilias Kiourktsidis
486f0a9367 Raise error when ModelSerializer used with abstract model 2015-03-23 15:01:19 +00:00