Commit Graph

299 Commits

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