Commit Graph

1046 Commits

Author SHA1 Message Date
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
Andrea Grandi
a0049dd489 Add a blank line to make lint happier 2015-03-22 23:21:09 +00:00
Andrea Grandi
1d883e0825 Add two more tests for IPAddressField, checking the IPv4 and IPv6 protocols separately 2015-03-22 16:46:16 +00:00
Ion Scerbatiuc
fac2785341 Handling the fallback in reverse 2015-03-19 16:12:28 -07:00
Ion Scerbatiuc
90280a3437 Handle reversal of non-API view_name in HyperLinkedRelatedField 2015-03-19 14:16:45 -07:00
José Padilla
76ede5beda Simplify test settings 2015-03-14 15:57:22 -04:00
Raphaël Barrois
8d0dbc8092 Fix lookup_url_kwarg handling in viewsets.
The ``lookup_url_kwarg`` is intended to set the name of a field in the
URL regexps when using custom ``lookup_field``, but the routers ignore
it altogether.
2015-03-13 01:07:20 +01:00
Matt d'Entremont
fb58ef043c Add support for serializing models with m2m related fields
- In both ManyRelatedField, provide an empty return when trying to
  access a relation field if the instance in question has no PK (so
  likely hasn't been inserted yet)
- Add relevant tests
- Without these changes, exceptions would be raised when trying to
  serialize the uncreated models as it is impossible to query
  relations without a PK
- Add test to ensure RelatedField does not regress as currently 
  supports being serialized with and unsaved model
2015-03-06 12:50:37 -04:00
Tom Christie
18cc0230bf Clean up pagination attributes 2015-03-04 15:51:00 +00:00
Aider Ibragimov
5f8338e276 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework into feature/filepathfield 2015-03-03 14:34:18 +03:00
Aider Ibragimov
c20a0250df add FilePathField, update docs 2015-03-03 14:34:06 +03:00
Kevin Wood
b582d52afb Fix docstring formatting 2015-02-28 13:06:47 -08:00
Aider Ibragimov
de72022f80 Merge branch 'master' of https://github.com/Ins1ne/django-rest-framework into feature/ipaddress 2015-02-28 14:29:27 +03:00
Aider Ibragimov
4d5eee04a0 add IPAddressField, update docs 2015-02-28 10:11:38 +03:00
Kevin Wood
78e8b1b010 Updated CreateOnlyDefault to call set_context on its default (if callable) 2015-02-27 22:14:15 -08:00
Tom Christie
cda74b5997 Merge pull request #2608 from ezheidtmann/dont-swallow-errors-in-callable-sources
Dont swallow errors in callable sources
2015-02-27 09:13:01 +00:00
Evan Heidtmann
16ffe5e31f Add tests for callable attributes raising exceptions 2015-02-26 09:05:37 -08:00
Tom Christie
c66f23391a Merge pull request #2572 from Ins1ne/master
Fix UniqueTogetherValidator for NULL values
2015-02-26 15:56:18 +00:00
Tom Christie
1b398a20de Who care what we do when it's totally malformed? Not me. 2015-02-26 13:41:25 +00:00
Tom Christie
4b745eef3a Update test for more graceful 1.8 handling of malformed filename encodings 2015-02-26 13:25:14 +00:00
Yannick PEROUX
9cafdd1854 Add a test for #2583 fix 2015-02-25 11:54:56 +01:00
Rense VanderHoek
9cb547b85f Validator-fix, added min/max fields to test_metadata 2015-02-20 17:34:49 +01:00
José Padilla
777f4e8212 Failing test for #2552 2015-02-19 12:23:44 -04:00
Aider Ibragimov
aa7ed316d8 Return UniquenessTogetherModel to previous state 2015-02-19 18:09:04 +03:00
Aider Ibragimov
fe8d95f93e Skip validation of NULL field only if it part of unique_together 2015-02-19 18:03:44 +03:00
Aider Ibragimov
3d85473edf Fix UniqueTogetherValidator for NULL values 2015-02-18 21:00:12 +03:00
Tom Christie
4248a8d3fc Merge pull request #2198 from tomchristie/version-3.1
Version 3.1
2015-02-13 13:38:44 +00:00
donewell
3d25dadbf3 change custom message for clarity 2015-02-11 11:20:03 +00:00
donewell
9ea615af14 add message to custom permission
change detail to message and update text
2015-02-10 20:11:53 +00:00
Carlton Gibson
d87bb67d11 Failing test case for #1488 2015-02-10 10:50:35 +01:00
Tom Christie
fbb21caaaa Merge master 2015-02-09 20:43:50 +00:00
Tom Christie
b2939c157d Fixes for latest version of pep8 2015-02-09 17:43:20 +00:00
Tom Christie
0669f507b3 pep8 fix 2015-02-09 17:22:13 +00:00
Tom Christie
54d82f59ed Py3 compat fix 2015-02-09 17:19:22 +00:00
Tom Christie
dec3493d7c Minor cleanup 2015-02-06 14:43:43 +00:00
José Padilla
7f801b9a01 Add trim_whitespace to CharField #2517
If set to `True` then leading and trailing
whitespace is trimmed. Defaults to `True`.
2015-02-06 01:09:19 -04:00
Tom Christie
f98f842827 Minor bits of test cleanup 2015-02-05 01:24:55 +00:00
Tom Christie
e1c4513312 Fix NamespaceVersioning with hyperlinked serializer fields 2015-02-05 00:58:09 +00:00
Ofir Ovadia
58e7bbc8ec Prefetching the user object when getting the token in TokenAuthentication.
Since the user object is fetched 4 lines after getting Token from the database, this removes a DB query for each token-authenticated request.
2015-02-04 16:08:41 +02:00
Brandon Cazander
030f01afdb Reorganize tests. 2015-02-03 02:14:38 -08:00
Brandon Cazander
f3067a7fab Remove unnecessary APIRequestFactory get from tests. 2015-02-02 20:41:06 -08:00
Brandon Cazander
77d061d234 Provide rest_framework.resolve. Fixes #2489 2015-02-02 20:37:33 -08:00
Tom Christie
2cc4cb2465 Fix error text in test. 2015-01-31 08:53:40 +00:00
Tom Christie
4ee4b4f2dc Merge master 2015-01-30 14:00:25 +00:00
Tymur Maryokhin
ba7dca893c Removed router check for deprecated '.model' attribute 2015-01-29 17:28:03 +01:00
Tom Christie
6d89430dd2 Merge pull request #2475 from sdreher/master
ManyRelatedField.get_value clearing field on partial update
2015-01-28 09:26:49 +00:00
Brandon Cazander
ac87490b91 Clone the versioning_scheme when necessary. Fixes #2477 2015-01-27 17:10:17 -08:00
Susan Dreher
e7da266a86 reorganize imports 2015-01-27 16:32:15 -05:00
Susan Dreher
1714ceae9f reorganize imports 2015-01-27 16:31:25 -05:00
Susan Dreher
8c3f82fb18 🐛 ManyRelatedField get_value clearing field on partial update
A PATCH to a serializer's non-related CharField was clearing an ancillary StringRelatedField(many=True) field.
The issue appears to be in the ManyRelatedField's get_value method, which was returning a [] instead of empty
when the request data was a MultiDict.

This fix mirrors code in fields.py, class Field, get_value, Ln. 272, which explicitly returns empty on a partial update.

Tests added to demonstrate the issue.
2015-01-27 16:18:51 -05:00
Tom Christie
65bca59ea5 Reload api_settings when using Django's 'override_settings' 2015-01-27 13:51:30 +00:00
Brandon Cazander
6c083b12a1 Streamline test for #2455 2015-01-24 11:00:36 -08:00
Brandon Cazander
0ee2edc0a1 Add missed files for test. 2015-01-24 01:44:09 -08:00
Brandon Cazander
b09ef28959 Add failing test for request.version AttributeError in BrowsableAPI. 2015-01-24 01:37:23 -08:00
Tom Christie
35f6a82462 Added DictField and support for HStoreField. 2015-01-23 16:27:23 +00:00
Tom Christie
e8db1834d3 Added UUIDField. 2015-01-23 15:24:06 +00:00
Tom Christie
39f26c9eca Merge master 2015-01-23 14:28:59 +00:00
Tom Christie
f3b6eedb8a More sensible response caching. 2015-01-23 12:56:55 +00:00
Tom Christie
f1ac9d3f9b More graceful handling of malformed Content-Disposition 2015-01-23 12:26:44 +00:00
Tom Christie
4cb164b66c Add missing skipUnless(django_filters) 2015-01-23 11:49:57 +00:00
Tom Christie
e988d57853 Fix template loader monkey patching to also support 1.8 2015-01-23 11:47:01 +00:00
Tom Christie
43d983fae8 Add paging controls 2015-01-22 17:25:12 +00:00
Tom Christie
0822c9e558 Cursor pagination now works with OrderingFilter 2015-01-22 16:12:05 +00:00
Tom Christie
408261ee02 Support ordering attribute either on view or on pagination class for CursorPagination 2015-01-22 15:15:52 +00:00
Tom Christie
83a82b44a5 Support for tuple ordering in cursor pagination 2015-01-22 15:07:01 +00:00
Tom Christie
94b5f7a86e Tidy up cursor tests and make more comprehensive 2015-01-22 12:14:52 +00:00
Tom Christie
f1af603fb0 Tests for reverse pagination 2015-01-22 10:51:04 +00:00
Tom Christie
cae9528c54 Add support for reverse cursors 2015-01-22 10:28:19 +00:00
Tom Christie
5e52f0fd8c Merge branch 'version-3.1' into cursor-pagination 2015-01-21 20:29:58 +00:00
Tom Christie
e59b3d1718 Make ReturnDict cachable. Closes #2360. 2015-01-21 14:18:13 +00:00
Tom Christie
9ec08ce578 Merge master 2015-01-21 13:12:14 +00:00
Tom Christie
da6ef3d0b0 Allow missing fields option for inherited serializers. Closes #2388. 2015-01-21 13:03:37 +00:00
Tom Christie
e5b94f7b7b Merge branch 'version-3.1' into cursor-pagination 2015-01-19 15:23:08 +00:00
Tom Christie
6065cdbd93 Merge master 2015-01-19 15:16:57 +00:00
Tom Christie
4f3c3a06cf Drop trailing whitespace on indented JSON output. Closes #2429. 2015-01-19 14:41:10 +00:00
Tom Christie
dbb684117f Add offset support for cursor pagination 2015-01-19 09:24:42 +00:00
David Muller
b5128ca574 Save objects before assigning them in InheritedModelSerializationTests; Django 1.8 now throws an error when assigning unsaved objects to Foreign Key, GenericForeignKey, and OneToOneFields 2015-01-18 15:19:11 -08:00
Tom Christie
4919492582 First pass at cursor pagination 2015-01-17 00:10:43 +00:00
Tom Christie
86d2774cf3 Fix compat issues 2015-01-16 20:30:46 +00:00
Tom Christie
8b0f25aa0a More pagination tests & cleanup 2015-01-16 16:55:46 +00:00
Tom Christie
50db8c092a Minor test cleanup 2015-01-16 16:55:28 +00:00
Tom Christie
53edd37df5 Tests for LimitOffsetPagination 2015-01-15 21:07:05 +00:00
Tom Christie
73feaf6299 First pass at 3.1 pagination API 2015-01-09 15:30:36 +00:00
Tom Christie
11efde8905 Merge pull request #2373 from jakul/document-translations-3.1
Document how to translate DRF error messages (version 3.1)
2015-01-09 11:57:02 +00:00
Craig Blaszczyk
7f8d314101 update tests to expect new error messages 2015-01-08 17:16:47 +00:00
Craig Blaszczyk
91e316f781 prefer single quotes in source and double quotes in user visible strings; add some missing full stops to user visible strings 2015-01-07 12:46:23 +00:00
Tom Christie
949e3b7507 Merge branch 'master' into version-3.1 2015-01-05 15:04:23 +00:00
Tom Christie
b6ca7248eb required=False allows omission of value for output. Closes #2342 2015-01-05 14:32:12 +00:00
Tom Christie
6168f60ba8 Merge branch 'master' into version-3.1 2015-01-05 11:02:28 +00:00
Craig Blaszczyk
32506e2075 update expected error messages in tests 2015-01-02 11:08:39 +00:00
Tom Christie
efa5942ce1 Support namespaced router URLs with DefaultRouter. 2014-12-28 12:02:52 +00:00
Tom Christie
67fc002f91 Drop unused import 2014-12-28 11:27:06 +00:00
Tom Christie
7b42c5ed17 Remove broken test. Closes #2359. 2014-12-28 11:14:32 +00:00
Remi Paulmier
b32ecdefba modified the tests accordingly 2014-12-24 14:07:28 +01:00
Tom Christie
ffb8d568e0 Merge pull request #2330 from tomchristie/better-blank-html-behavior
Better behavior with null and '' for blank HTML fields.
2014-12-20 16:40:27 +00:00
Tom Christie
77e3021fea Better behaviour with null and '' for blank HTML fields. 2014-12-20 16:26:51 +00:00
Tom Christie
2a1485e009 Final bits of docs for ModelSerializer fields API 2014-12-19 21:32:43 +00:00
Tom Christie
d109ae0a2e Merge pull request #2010 from tanwanirahul/master
Ability to customize method names without creating a custom router
2014-12-19 16:09:01 +00:00
tanwanirahul
2448cc8e85 Updated tests to use url_path attribute in list and detail decorators 2014-12-19 19:53:48 +05:30
Tom Christie
6d907cde9a get_field_names, get_default_field_names 2014-12-19 12:18:40 +00:00
Tom Christie
c8d88c8c8a Merge branch 'master' into version-3.1 2014-12-18 11:21:25 +00:00
Tom Christie
1087ccbb25 Drop print statements in tests 2014-12-18 10:39:00 +00:00
Tom Christie
87ac64e41b Fixes for behavior with empty HTML fields. 2014-12-18 10:36:52 +00:00
Tom Christie
ad6533e554 Merge pull request #2294 from tomchristie/fix-empty-html-values-with-default
Fix empty HTML values when a default is provided.
2014-12-17 15:24:01 +00:00
Tom Christie
3fff5cb6e0 Fix empty HTML values when a default is provided. 2014-12-17 15:13:48 +00:00
Tom Christie
c6137bbf5a Serializer API restrictions. 2014-12-17 14:14:51 +00:00
Tom Christie
7fbf5b0e6b Merge pull request #2155 from martinmaillard/set-user-on-wrapped-request
Set authenticated user on wrapped request
2014-12-17 13:12:01 +00:00
Tom Christie
05a6eaec8a More docs, plus 'ALLOWED_VERSIONS' setting. 2014-12-17 12:41:46 +00:00
Tom Christie
4e91ec6133 Added NamespaceVersioning 2014-12-16 16:14:08 +00:00
Tom Christie
7cfa0e0306 Merge lateset version-3.1 2014-12-16 15:35:25 +00:00
Tom Christie
74483338ab Merge branch 'master' into version-3.1 2014-12-16 15:34:28 +00:00
Tom Christie
6e51e4f5cd Versioning first pass 2014-12-16 15:34:19 +00:00
Martin Maillard
a68e78bd0b Add test integrated with middleware 2014-12-16 15:41:16 +01:00
Tom Christie
a15db353bf Minor test cleanup 2014-12-15 13:18:39 +00:00
Tom Christie
b6ee784240 Merge master 2014-12-15 12:18:55 +00:00
Tom Christie
72e08a3e8b Use unicode internally everywhere for 'repr' 2014-12-15 11:55:17 +00:00
Tom Christie
8934e61b67 Merge branch 'jpadilla-exception-handler-context' into version-3.1 2014-12-15 09:20:27 +00:00
Tom Christie
4778463e32 Merge branch 'master' into version-3.1 2014-12-15 09:18:11 +00:00
Tom Christie
5e7c9687c7 First pass at serializer repr bug 2014-12-15 09:13:02 +00:00
Tom Christie
4fb757146a Fix test for python2/3 compat 2014-12-13 15:04:39 +00:00
Tom Christie
aa571abb20 Better errors when serializer has incorrectly named field. 2014-12-13 14:58:04 +00:00
Tom Christie
baaa356489 Merge master 2014-12-12 15:37:43 +00:00
Tom Christie
8825b258ca Clean up import ordering 2014-12-12 13:22:24 +00:00
Tom Christie
e3b16c8bc6 Python 3 test fix 2014-12-12 13:16:18 +00:00
Tom Christie
78312d44d1 Client.logout() also clears any force_authenticate 2014-12-12 13:13:08 +00:00
Martin Maillard
dbd057b9a9 Add test 2014-12-11 20:20:46 +01:00
Tom Christie
ca7b1f6d51 Optimizations play nicely with select_related, prefetch_related 2014-12-10 21:09:45 +00:00
Tom Christie
720a37d3de Hyperlinked PK optimization. Closes #1872. 2014-12-09 17:28:56 +00:00
Tom Christie
8933bc4b14 Merge branch 'validator-pollution' of git://github.com/mhsparks/django-rest-framework into mhsparks-validator-pollution 2014-12-09 16:23:33 +00:00
José Padilla
afe7ed9333 Add allow_blank for ChoiceField #2184
This makes a ChoiceField optional in HTML if
model field has `blank=True` set.
2014-12-09 09:25:06 -04:00
Tom Christie
eee02a47d9 Added ListSerializer.validate(). Closes #2168. 2014-12-08 14:56:45 +00:00
Victor Cabral
0c0d65d232 Fixed unit test for auth login 2014-12-08 09:06:52 +07:00
Tom Christie
544967f36e Test tweaks 2014-12-05 14:15:58 +00:00
Tom Christie
c611a2c1fe Merge pull request #2213 from BrickXu/master
Raise error if `fields` on serializer is not a list of strings.
2014-12-05 14:00:59 +00:00
Tom Christie
65d6cba75f Merge pull request #2200 from maryokhin/master
Clean up compat code
2014-12-05 13:14:14 +00:00
Tom Christie
de4ef6e394 Merge pull request #2195 from tomchristie/tomchristie-escape-u2028-u2029-json
Escape \u2028 and \u2029 in JSON output.
2014-12-05 12:35:24 +00:00
BrickXu
d68c614504 Add validation for fields & exclude type. 2014-12-05 14:51:39 +08:00
Tymur Maryokhin
d9930181ee Removed unused imports, pep8 fixes, typo fixes 2014-12-05 00:29:28 +01:00
Tymur Maryokhin
d54c67d79d Removed custom StringIO, force_text, smart_text compat 2014-12-04 03:11:42 +01:00
Tymur Maryokhin
09e59f2686 Removed custom python_2_unicode_compatible. Closes #2183 2014-12-04 02:50:25 +01:00
Tom Christie
3d6620c72a Merge 2014-12-03 23:24:06 +00:00
Tom Christie
f74e52b31e Merge 2014-12-03 23:14:58 +00:00
Tom Christie
6369f92125 Merge 2014-12-03 23:12:52 +00:00
Tom Christie
23fa6e54ce Escape \u2028 and \u2029 in JSON output.
Closes #2169.
2014-12-03 22:33:34 +00:00
Mark Hughes
55528addf9 Added test to show potential issue with UniqueValidator being added to the underlying Django model. 2014-12-03 12:30:15 +00:00
Tom Christie
c5a2d501e5 Merge pull request #2175 from BrickXu/fix_2171
Not allow to pass an empty actions to viewset.as_view()
2014-12-03 08:53:04 +00:00
Tom Christie
0359e9250d FileUploadParser. Raising StopFutureHandlers removes any handlers not yet run for the active set. Closes #2109. 2014-12-02 13:52:46 +00:00
Tom Christie
76ac641fbd Minor tweaks for helpful message on Model.objects.create() failure. 2014-12-02 13:04:49 +00:00
Tom Christie
54b7b32818 Merge branch 'fixes/2013' of git://github.com/gregmuellegger/django-rest-framework into gregmuellegger-fixes/2013 2014-12-02 12:46:47 +00:00
BrickXu
53f52765fc Not allow to pass an empty actions to viewset.as_view(). Refs issue #2171 2014-12-02 17:07:55 +08:00
Tymur Maryokhin
e2ea98e8ab Fixed typos 2014-11-29 20:23:55 +01:00
Tymur Maryokhin
dd9d40d8c0 Moved non-conflicting models 2014-11-29 20:04:50 +01:00
José Padilla
7f9dc73672 Remove XML support from core 2014-11-29 14:57:51 -04:00
José Padilla
fe745b9616 Remove JSONP support from core 2014-11-29 14:55:33 -04:00
Tymur Maryokhin
2f03483f96 Removed unused models 2014-11-29 19:45:26 +01:00
José Padilla
731c8421af Remove YAML support from core 2014-11-29 14:43:05 -04:00
José Padilla
0cc990792c Merge branch 'version-3.1' into oauth_as_package
Conflicts:
	requirements-test.txt
	rest_framework/compat.py
	tests/settings.py
	tox.ini
2014-11-28 12:14:40 -04:00
Tom Christie
3a5b3772fe Use ImproperlyConfigured when model meta lookup fails 2014-11-28 15:36:04 +00:00
Tom Christie
6fbd23ab34 Merge pull request #2086 from beck/doug/blow-up-with-bad-models
Ensure _resolve_model does not return None
2014-11-28 15:31:51 +00:00
Tom Christie
8d989bb16d Merge pull request #2143 from linovia/bugfix/1850
Bugfix for #1850
2014-11-28 15:01:56 +00:00
Tom Christie
c8764de788 Drop defunct tests 2014-11-28 13:04:42 +00:00
Xavier Ordoquy
767414439b Be nicer with __closable_objects. 2014-11-26 22:20:14 +01:00
Xavier Ordoquy
f5e5ed0077 Merge remote-tracking branch 'reference/master' into bugfix/1850 2014-11-26 16:36:56 +01:00
José Padilla
653d626b3c Fix failing YAML tests 2014-11-25 11:33:18 -04:00
Tom Christie
9c58dfec4e Fix shoddy test case 2014-11-25 10:34:21 +00:00
Tom Christie
8586290df8 Apply defaults and requiredness to unique_together fields. Closes #2092. 2014-11-19 13:55:10 +00:00
Tom Christie
e49d22dbda Allow blank choices to render. Closes #2071. 2014-11-19 09:31:26 +00:00
Doug Beck
67735687b2 Ensure _resolve_model does not return None 2014-11-18 01:26:23 -05:00
Gregor Müllegger
ad060aa360 More helpful error message when default .create fails. Closes #2013. 2014-11-15 15:29:52 +01:00
Eleni Lixourioti
1aa7783095 Merge branch 'version-3.1' of github.com:tomchristie/django-rest-framework into oauth_as_package
Conflicts:
	.travis.yml
2014-11-15 14:27:41 +00:00
Tom Christie
ea98de9b88 Model fields with .blank or .null now map to required=False. Closes #2017. Closes #2021. 2014-11-13 19:28:57 +00:00
Tom Christie
9e75c4d8ea Reinstate OPTIONS tests 2014-11-13 16:24:03 +00:00
Tom Christie
502a86cedb Remove tests/settings. Using conftest instead. 2014-11-13 16:10:48 +00:00
Tom Christie
e5cd693e7b Remove test cruft 2014-11-13 16:07:25 +00:00
Tom Christie
f387cd89da Uniqueness constraints imply a forced 'required=True'. Refs #1945 2014-11-10 12:21:27 +00:00
Tom Christie
db1dd8e240 Tests & fixes for list serialization 2014-11-06 17:32:33 +00:00
Tom Christie
9923a6ce90 Fix tests for py2/3 compat 2014-11-06 11:51:10 +00:00
Tom Christie
ed541864e6 Support for bulk create. Closes #1965. 2014-11-06 10:34:59 +00:00
Tom Christie
0a5d088287 Fix failing copy of fields when RegexValidator is used. Closes #1954. 2014-11-05 10:48:30 +00:00
Tom Christie
2b535954cd Py2/3 compat for validation test 2014-11-03 14:14:12 +00:00
Tom Christie
003c42b0f5 Use invalid_data key for error message. Closes #2002. 2014-11-03 14:01:02 +00:00
tanwanirahul
ea8c405201 Tests for validating custom_method_name router attribute 2014-11-03 14:44:47 +01:00
Tom Christie
65a0d083d6 Merge pull request #1963 from carljm/lazy-fields
Set up serializer fields lazily on-demand.
2014-10-31 16:40:06 +00:00
Tom Christie
207208fedf Lazy loading of fields and validators. Closes #1963. 2014-10-31 16:38:39 +00:00
Tom Christie
11075d3770 Merge branch 'master' into version-3.0 2014-10-31 16:05:45 +00:00
Tom Christie
0dea509dc9 Nested serializer tests 2014-10-30 15:59:16 +00:00
Tom Christie
9ebaabd6eb unique_for_date/unique_for_month/unique_for_year 2014-10-28 16:21:49 +00:00
Tom Christie
ae53fdff9c First pass at unique_for_date, unique_for_month, unique_for_year 2014-10-22 13:30:28 +01:00
Tom Christie
c5d1be8eac .validate() can raise field errors or non-field errors 2014-10-22 10:32:32 +01:00
Carl Meyer
140f8620ae Set up serializer fields lazily on-demand.
This avoids AppRegistryNotReady problems in Django 1.7 with nested serializers,
which are instantiated at import time, possibly before Django's app registry is
fully populated.
2014-10-17 09:50:57 -06:00
Tom Christie
05cbec9dd7 Use serializers.ValidationError 2014-10-17 13:23:14 +01:00
Tom Christie
3af5df1955 Performance for PK fields 2014-10-16 20:47:57 +01:00
Tom Christie
d9a199ca0d exceptions.ValidationFailed, not Django's ValidationError 2014-10-10 14:16:09 +01:00
Tom Christie
5d247a65c8 First pass on nested serializers in HTML 2014-10-09 15:11:19 +01:00
Tom Christie
5f4cc52ef5 Tweaking 2014-10-09 10:11:44 +01:00
Tom Christie
5ead8dc89d Support empty file fields 2014-10-08 16:59:52 +01:00
Tom Christie
af0f01c5b6 Move generic relation tests 2014-10-08 11:23:40 +01:00
Tom Christie
6b09e5f2bb Tests for generic relationships 2014-10-08 11:22:10 +01:00
Tom Christie
093febb912 Tests for relational fields 2014-10-08 11:04:08 +01:00
Xavier Ordoquy
311d315a73 Reverted 59d0a0387d and fixed the tests 2014-10-08 08:33:28 +02:00
Tom Christie
6bfed6f852 Enforce uniqueness validation for relational fields 2014-10-07 17:04:53 +01:00
Jones Chi
2dfe75c23a Fix follow does not work on APIClient
Handle follow just like Django's Client.
2014-10-06 15:10:35 +08:00
Craig de Stigter
857a8486b1 More spelling tweaks 2014-10-03 09:00:33 +13:00
Craig de Stigter
dfab9af294 Minor: fix spelling and grammar, mostly in 3.0 announcement 2014-10-03 08:41:18 +13:00
Tom Christie
c171fa21ac First pass at HTML form rendering 2014-10-01 19:44:46 +01:00
Tom Christie
d1b2c8ac7f Absolute URLs for file fields 2014-09-29 14:12:26 +01:00
Tom Christie
4798df52df Update release notes 2014-09-29 12:57:05 +01:00
Tom Christie
9805a085fb UniqueTogetherValidator 2014-09-29 11:23:02 +01:00
Tom Christie
43fd5a8730 Uniqueness validation 2014-09-29 09:24:03 +01:00
Tom Christie
dee3f78cb6 FileField and ImageField 2014-09-26 17:06:20 +01:00
Tom Christie
8be4496586 Drop erronous print statements 2014-09-26 13:59:37 +01:00
Tom Christie
2e87de0143 Added ListField 2014-09-26 13:08:20 +01:00
Tom Christie
8b8623c5f8 Allow many, partial and context in BaseSerializer 2014-09-26 12:48:20 +01:00
Tom Christie
2859eaf524 request.data attribute 2014-09-26 10:46:52 +01:00
Tom Christie
417fe1b675 Partial support 2014-09-25 13:37:26 +01:00
Tom Christie
8ee92f8a18 Refuse to downcast from datetime to date or time 2014-09-25 13:10:33 +01:00
Tom Christie
b47ca158b9 Check for redundant on SerializerMethodField 2014-09-25 12:09:12 +01:00
Tom Christie
64632da371 Clean up bind - no longer needs to be called multiple times in nested fields 2014-09-25 11:40:32 +01:00
Tom Christie
1420c76453 Ensure proper sorting of 'choices' attribute on ChoiceField 2014-09-25 10:49:25 +01:00
Tom Christie
fb1546ee50 Enforce field_name != source 2014-09-24 20:53:37 +01:00
Tom Christie
358445c174 Drop redundant OPTIONS tests 2014-09-24 14:52:34 +01:00
Tom Christie
f4b1dcb167 OPTIONS support 2014-09-24 14:09:49 +01:00
José Padilla
90139b3efc Remove left unicode strings 2014-09-23 21:18:56 -04:00
José Padilla
e8c01ecdab Correctly propagate cloned_request for OPTIONS
Update to fix pending changes in #1507
2014-09-23 21:12:58 -04:00
Tom Christie
0404f09a7e NullBooleanField 2014-09-23 14:30:17 +01:00
Tom Christie
f22d0afc3d Tests for field choices 2014-09-23 14:15:00 +01:00
Tom Christie
5d80f7f932 allow_blank, allow_null 2014-09-22 17:46:02 +01:00
Tom Christie
5a95baf2a2 Tests & tweaks for ChoiceField 2014-09-22 16:52:57 +01:00
Tom Christie
b5454dd022 Tests and tweaks for choice fields 2014-09-22 16:50:04 +01:00
Tom Christie
e5f0a97595 More compat fixes 2014-09-22 16:45:06 +01:00
Tom Christie
5586b6581d Support format=None for date/time fields 2014-09-22 16:02:59 +01:00
Tom Christie
4db23cae21 Tweaks to DecimalField 2014-09-22 15:34:06 +01:00
Tom Christie
249253a144 Fix compat issues 2014-09-22 14:54:33 +01:00
Tom Christie
afb3f8ab0a Tests and tweaks for text fields 2014-09-22 13:26:47 +01:00
Tom Christie
af46fd6b00 Field tests and associated cleanup 2014-09-22 12:25:57 +01:00
Tom Christie
cf72b9a8b7 Moar tests 2014-09-19 16:43:13 +01:00
Tom Christie
b361c54c5c Test rejigging 2014-09-19 15:46:32 +01:00
Tom Christie
88008c0a68 Merge branch 'master' into version-3.0 2014-09-19 14:05:50 +01:00
Tom Christie
12ccb0fe8a Test tweaking 2014-09-19 09:09:26 +01:00
Tom Christie
f90049316a Added a model update integration test 2014-09-18 15:47:27 +01:00
Tom Christie
106362b437 ModelSerializer.create() to handle many to many by default 2014-09-18 14:58:08 +01:00
Tom Christie
9fdb2280d1 First pass on ManyRelation 2014-09-18 14:23:00 +01:00
Tom Christie
3bc628edc0 Test for custom fields 2014-09-18 13:07:38 +01:00
Tom Christie
87734be5f4 Configuration correctness tests on ModelSerializer 2014-09-18 12:17:21 +01:00
Tom Christie
5b7e4af0d6 get_base_field() refactor 2014-09-18 11:20:56 +01:00
Tom Christie
c0155fd9dc Update comments 2014-09-17 14:11:53 +01:00
Tom Christie
4ddc661b01 Tests for through relationships 2014-09-15 14:05:58 +01:00
Tom Christie
d196608d5a Fix nested model serializer base class 2014-09-15 13:55:09 +01:00
Tom Christie
0c15b97b33 Tests for reverse relationships 2014-09-15 13:48:03 +01:00
Tom Christie
c1e2a9cba6 Clean up field mapping tests 2014-09-15 13:38:28 +01:00
Tom Christie
3cf7ed10d2 Fix erronous import 2014-09-15 13:10:58 +01:00
Tom Christie
40dc588a37 Drop label from serializer fields when not needed 2014-09-15 09:50:51 +01:00
Tom Christie
afb28a44ad Dealing with reverse relationships 2014-09-12 21:32:20 +01:00
Tom Christie
1f75ffc791 Access validation messages in a way thats compatible with 1.4, 1.5 2014-09-12 19:50:30 +01:00
Tom Christie
b73a205cc0 Tests for relational fields (not including many=True) 2014-09-12 17:03:42 +01:00
Tom Christie
79715f01f8 Coerce dates etc to ISO_8601 in seralizer, by default. 2014-09-12 12:10:22 +01:00
Tom Christie
5e39e159ee UNICODE_JSON and COMPACT_JSON settings 2014-09-12 11:38:22 +01:00
Tom Christie
250755def7 Clean up relational fields queryset usage 2014-09-12 10:59:51 +01:00
Tom Christie
0d354e8f92 to_internal_value() and to_representation() 2014-09-12 09:49:35 +01:00
Tom Christie
adcb64ab41 MethodField -> SerializerMethodField 2014-09-12 09:12:56 +01:00
Tom Christie
040bfcc09c NotImplemented stubs for Field, and DecimalField improvements 2014-09-11 21:48:54 +01:00
Tom Christie
19b8f779de Throttles now use Retry-After header and no longer support the custom style 2014-09-11 20:43:44 +01:00
Tom Christie
bf52d04f4c Nice manager representations on serializer classes 2014-09-11 20:37:27 +01:00
Tom Christie
de301f3b66 Merge master 2014-09-11 13:20:44 +01:00
Marek Skrajnowski
ae84438530 Added DefaultRouter support (and test) for viewsets without the default action implemented, which is usually the list action. 2014-09-11 12:42:36 +02:00
Tom Christie
b1c07670ca Fleshing out serializer fields 2014-09-09 17:46:28 +01:00
Tom Christie
21980b800d More test sorting 2014-09-08 14:24:05 +01:00
Tom Christie
168710813c Merge pull request #1844 from adamsc64/issue_1533
Fixed #1533 - Resolved issue with integer keys on nested choices never v...
2014-09-08 10:15:26 +01:00
Christopher Adams
613a301a36 Fixed #1533 - Resolved issue with integer keys on nested choices never validating.
- Added unit test for nested `choices` argument.
- Added unit test for non-nested `choices` argument.
2014-09-06 17:13:28 -04:00
Tom Christie
5bbfef36f4 Merge pull request #1838 from jbittel/fix-encoded-filename-rfc6266
Support RFC6266 encoded filenames
2014-09-06 07:13:12 +01:00
José Padilla
97ebd68f68 Remove unicode strings 2014-09-05 16:01:17 -07:00
José Padilla
3e20b0110c Fix linting issues 2014-09-05 15:58:42 -07:00
José Padilla
d44a8f24ff Merge remote-tracking branch 'poswald/view-description-as-promise' into view-description-as-promise 2014-09-05 15:34:16 -07:00
Jason Bittel
959e234260 Move parser tests to correct directory 2014-09-05 15:33:47 -07:00
Jharrod LaFon
baa518cd89 Moved OAuth support out of DRF and into a separate package, per #1767 2014-09-05 15:30:01 -07:00
Jason Bittel
c8e475023c Fix encoded filename parsing to allow for lang 2014-09-05 15:22:43 -07:00
Vladislav Vlastovskiy
644f9b5421 Removed assert for wrong charset 2014-09-05 14:51:31 -07:00
Vladislav Vlastovskiy
6e90dad8e3 Added test for encoded filename 2014-09-05 14:51:07 -07:00
José Padilla
5add55abc8 Failing test case for #1432 2014-09-05 11:33:54 -07:00
Tom Christie
d934824bff Workin on 2014-09-05 16:29:46 +01:00
Piotr Jakimiak
cb3cc00edd Delete useless assert 2014-09-05 14:36:35 +02:00
Piotr Jakimiak
c3b841ae44 Use Serializer instead of ModelSerializer 2014-09-05 14:08:11 +02:00
Piotr Jakimiak
e39422e35f Check object in tests 2014-09-05 11:27:36 +02:00
Piotr Jakimiak
d9633c6817 Fix returning None when allow_none is True in CharField 2014-09-05 11:08:34 +02:00
Tom Christie
2e632e5af2 Merge pull request #1820 from carltongibson/login-dropdown
Hide login link in browsable API if the login view is not registered.
2014-09-05 09:07:14 +01:00
Tom Christie
c1036c1753 More test passing 2014-09-03 16:34:09 +01:00
Michał Jaworski
deb19272b7 Add custom pagination test that covers case with custom object serializer class 2014-09-03 16:49:32 +02:00
Tom Christie
f2852811f9 Getting tests passing 2014-09-02 17:41:23 +01:00
Tom Christie
ec096a1cac Add relations and get tests running 2014-09-02 15:07:56 +01:00
Carlton Gibson
1e491c82e6 Fix imports 2014-09-02 15:29:21 +02:00
Carlton Gibson
4836afa89f Fix docstring 2014-09-02 15:11:23 +02:00
Carlton Gibson
fa0ef17737 Remove Login Dropdown when Auth Views are not registered.
Fixes #1738
2014-09-02 14:53:37 +02:00
Carlton Gibson
0e51dab8f4 Comform to flake8 2014-09-01 10:09:46 +02:00
Carlton Gibson
1c9c5d5c32 Regression for #1810: Test login view renders 2014-09-01 10:07:05 +02:00
Tom Christie
b3253b4283 Remove .model usage in tests.
Remove the shortcut `.model` view attribute usage from test cases.
2014-08-29 12:35:53 +01:00
Dmitry Mukhin
3b07d0c997 Merge branch 'master' into set-retry-after
Conflicts:
	tests/test_throttling.py
2014-08-20 20:04:48 +04:00
Tom Christie
63d02dbea8 Drop six from compat. 1.4.2 is now the lowest supported version. 2014-08-19 17:06:55 +01:00
Tom Christie
5358243ca5 Merge pull request #1778 from linovia/bugfix/1398
Bugfix/1398
2014-08-19 16:16:02 +01:00
Xavier Ordoquy
06b6b96f93 Remove duplicated model declaration. 2014-08-19 16:32:30 +02:00
Tom Christie
d2795dd26d Resolve linting issues 2014-08-19 13:54:52 +01:00
Tom Christie
bf09c32de8 Code linting and added runtests.py 2014-08-19 13:28:07 +01:00
Xavier Ordoquy
c9535c036b Merged #1398 against 2.4 branch. 2014-08-19 11:12:36 +02:00
Tom Christie
e385a7b8eb Merge master 2014-08-19 10:11:10 +01:00
Xavier Ordoquy
4876bec9f5 Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts:
	rest_framework/fields.py
2014-07-26 00:06:56 +02:00
Xavier Ordoquy
2489e38a06 Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts:
	.travis.yml
	docs/api-guide/viewsets.md
	rest_framework/serializers.py
	rest_framework/throttling.py
	tests/test_generics.py
	tests/test_serializers.py
	tox.ini
2014-06-23 14:02:45 +02:00
Xavier Ordoquy
e5441d845e Use urls functions from django instead of compat. 2014-05-01 08:41:37 +02:00
Xavier Ordoquy
7b4463f739 Merge remote-tracking branch 'reference/2.4.0' into feature/pytest
Conflicts:
	rest_framework/runtests/urls.py
	tests/test_response.py
	tox.ini
2014-05-01 08:01:38 +02:00
Xavier Ordoquy
2aca69a946 Merge remote-tracking branch 'reference/master' into feature/pytest
Conflicts:
	tests/test_serializer.py
2014-04-30 22:24:01 +02:00
Xavier Ordoquy
1797a74e82 Merge remote-tracking branch 'pelme/pytest' into feature/pytest
Conflicts:
	.travis.yml
	rest_framework/runtests/runtests.py
	tests/test_filters.py
	tests/test_pagination.py
	tox.ini
2014-04-17 09:53:44 +02:00
Andreas Pelme
971578ca34 Support for running the test suite with py.test
* Get rid of runtests.py
 * Moved test code  from rest_framework/tests and rest_framework/runtests to tests
 * Invoke py.test from setup.py
 * Invoke py.test from Travis
 * Invoke py.test from tox
 * Changed setUpClass to be just plain setUp in test_permissions.py
 * Updated contribution guideline to show how to invoke py.test
2014-03-02 12:40:30 +01:00