Commit Graph

2082 Commits

Author SHA1 Message Date
Kaptian
fffde8a63b Update throttling.py
Use pk pseudo attribute for identifying the user (in case the user model is not the default and has a different column name for the unique id)
2015-02-05 13:27:26 -08:00
Tom Christie
3b00824560 Merge pull request #2518 from longhotsummer/patch-1
FIX: Don't default to list in method args
2015-02-04 14:30:53 +00:00
Greg Kempe
e13d2af137 Parens around if clause 2015-02-04 16:26:23 +02:00
Greg Kempe
d920683237 Use inline if 2015-02-04 16:13:30 +02: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
Greg Kempe
7bb5fd270d FIX: Don't default to list in method args
Fixes @list_route and @detail_route so that they don't initialize their `methods` parameter as a list. In some cases the list gets cleared, and the result is that default parameter is now empty, and may get reused unexpectedly.
2015-02-04 16:03:03 +02:00
Jason Yan
4b65e9e42b Fixed missing whitespace in error string. 2015-02-02 16:14:34 -08:00
Omer Katz
8f1d42e7d5 Fixed typos in docstrings. 2015-02-02 10:50:54 +02:00
Tom Christie
53b29f0902 _closable_objects as an empty list, not deleted 2015-01-31 08:27:17 +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
Tom Christie
81c2562ec4 Merge pull request #2479 from lucaswiman/custom_user_shim_db_table
Use the proper db_table argument when constructing meta
2015-01-28 09:20:27 +00:00
Tom Christie
761f264f59 Merge pull request #2473 from tomchristie/reload-settings
Reload api_settings when using Django's 'override_settings'
2015-01-28 09:05:51 +00:00
Lucas Wiman
a1eba885e2 Use the proper db_table argument when constructing meta 2015-01-27 19:30:44 -08: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
Xavier Ordoquy
5b369bf5fe Bumped the version. 2015-01-27 19:45:37 +01:00
Tom Christie
65bca59ea5 Reload api_settings when using Django's 'override_settings' 2015-01-27 13:51:30 +00:00
Tom Christie
0cb5acee75 Merge pull request #2453 from alexsdutton/data-and-files-none-data
Pass {} as data to DataAndFiles, as it ends up in a MergeDict
2015-01-23 18:03:40 +00:00
Alexander Dutton
a1fa7218eb Pass {} as data to DataAndFiles, as it ends up in a MergeDict
In the same vein as #2399.
2015-01-23 16:52:24 +00:00
Tom Christie
35f6a82462 Added DictField and support for HStoreField. 2015-01-23 16:27:23 +00:00
Tom Christie
889a07f556 Support assignment in ClassLookupDict 2015-01-23 15:32:21 +00:00
Tom Christie
e8db1834d3 Added UUIDField. 2015-01-23 15:24:06 +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
25a703b42c Work around meta API differences 2015-01-23 11:15:11 +00:00
Xavier Ordoquy
15f797fd3e Owned by import * 2015-01-21 19:46:31 +01:00
Xavier Ordoquy
857185cf07 Workaround Django issue 24198. 2015-01-21 19:29:40 +01:00
Tom Christie
4cf03e30ff Do not render HTML output for hidden fields. Closes #2410. 2015-01-21 14:27:51 +00:00
Tom Christie
e59b3d1718 Make ReturnDict cachable. Closes #2360. 2015-01-21 14:18:13 +00:00
Tom Christie
da6ef3d0b0 Allow missing fields option for inherited serializers. Closes #2388. 2015-01-21 13:03:37 +00:00
Tom Christie
fdeef89ba7 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2015-01-19 14:48:42 +00:00
Tom Christie
46a3eda08d NotImplemented -> NotImplementedError 2015-01-19 14:48:13 +00:00
Alexander Dutton
af05820b1b NotImplemented is not an exception
`NotImplemented` is a singleton object, not an exception. You should be raising `NotImplementedError` here instead.
2015-01-19 14:23:13 +00:00
Tom Christie
0dffc46cb7 ReturnDict and ReturnList repr as standard dict/list. Closes #2421. 2015-01-19 14:21:09 +00:00
Tom Christie
da1db34a36 Handle UUID objects in JSONEncoder. Closes #2433. 2015-01-19 14:19:01 +00:00
Fabien Bochu
5484d570cb Fix timedelta JSON serialization on Python 2.6. 2015-01-19 13:09:08 +01:00
Tom Christie
4ce4132e08 Preserve ordering on relationship drop-down choices. Closes #2408. 2015-01-14 12:56:03 +00:00
Tom Christie
fb0a434f9b Merge pull request #2399 from askholme/master
Fix for FileUploadParser with 3.x
2015-01-12 12:21:35 +00:00
José Padilla
cc13ee0577 Fix error when NUM_PROXIES is greater than one 2015-01-12 08:12:24 -04:00
José Padilla
d6d08db0dd Fix ident format when using HTTP_X_FORWARDED_FOR
If NUM_PROXIES setting is set to None,
HTTP_X_FORWARDED_FOR might be used as is, which
might contain spaces and cause errors on
cache backends like memcached.
2015-01-11 10:58:08 -04:00
Ask Holme
d6bff10f98 Make FileUploadParser work with standard django API
Output from parsers ends up in a Django MergeDict and they exists elements to be dicts - not None
2015-01-10 18:15:21 +01:00
Xavier Ordoquy
02ee3871ae Merge remote-tracking branch 'origin/master' into release/3.0.3 2015-01-08 23:24:19 +01:00
Tom Christie
4d9e7a5356 Ammend docstring to use python2/3 compatible example. 2015-01-08 15:38:27 +00:00
Tom Christie
b33a6cbff1 Ensure urlparse is not publically exposed in compat.py - less chance of accidental conflict. 2015-01-08 14:16:58 +00:00
Xavier Ordoquy
b7015ea898 Bumped the version to 3.0.3. 2015-01-07 19:11:17 +01:00
Ryan Gaffney
07ad0474c0 Fix compatibility comment regarding OrderedDict 2015-01-06 14:34:36 -08:00
Tom Christie
26ac2656e5 Pass init arguments through to serializer from pagination serializer.
Closes #2355.

Normally a serializer won't need these arguments on __init__, but
if a user has customized __init__ they may expect them to be available.
2015-01-05 16:20:15 +00:00
Tom Christie
6fd33ddea9 Udpate docstring 2015-01-05 15:04:01 +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
8cf3744971 Ensure no invalid min_length/min_value/max_value arguments. Closes #2369. 2015-01-05 10:52:18 +00:00