Commit Graph

355 Commits

Author SHA1 Message Date
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
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
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