Commit Graph

2713 Commits

Author SHA1 Message Date
Tom Christie
2148f32007 Merge pull request #2700 from tomchristie/do-not-paginate-if-page-size-none
Do not paginate if PAGE_SIZE=None
2015-03-16 12:15:50 +00:00
Tom Christie
992971d648 Merge pull request #2631 from Ins1ne/feature/issue-2559
Allow blank/null on radio.html choices
2015-03-16 12:11:33 +00:00
Tom Christie
5cd0714dca Do not paginate if PAGE_SIZE=None 2015-03-16 12:05:31 +00:00
Tom Christie
4cd49d5de3 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2015-03-16 11:57:42 +00:00
Tom Christie
c573e7b4a8 Latest translation strings 2015-03-16 11:57:28 +00:00
Ion Scerbatiuc
022c4d540b Refactored DecimalField to allow easier subclassing 2015-03-14 07:16:17 -07:00
mochawich
2266fec99d fixed missing anchor closing tag
when next_url is none, big part of page html will be rendered under the <a href='#'> as it does not have a closing tag.
2015-03-13 17:03:51 +01: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
Dirk Moors
6c1d0d7ed0 Fixed problem with imporing rest_framework.views in apps.py 2015-03-12 16:36:26 +01:00
Carlton Gibson
53e1a2fcb9 Merge pull request #2637 from mdentremont/topic/allow-serialize-unsaved-with-relations
Support serializing unsaved models with related fields.
2015-03-08 20:22:49 +01:00
Aider Ibragimov
7159b31023 update vertical and inline layouts for radio choices 2015-03-07 07:17:22 +03:00
José Padilla
0e21f1c4f4 Merge pull request #2640 from Crystalnix/fix-remove-mergedict
Remove `MergeDict`
2015-03-06 19:17:58 -04: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
58dfde7fcd Tweaks for cursor pagination and docs 2015-03-06 10:22:32 +00:00
Egor Yurtaev
ce31e36973 Remove MergeDict
The class MergeDict is deprecated and will be removed in Django 1.9
2015-03-05 18:34:42 +06:00
Tom Christie
f7917928c0 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2015-03-04 16:17:44 +00:00
Tom Christie
18cc0230bf Clean up pagination attributes 2015-03-04 15:51:00 +00:00
Aider Ibragimov
c44376c613 remove unnecessary check 2015-03-04 14:17:58 +03:00
Aider Ibragimov
fdd811ec53 Allow blank/null on radio.html choices 2015-03-04 08:22:46 +03:00
Tymur Maryokhin
391b0ae21b Call default.set_context() only on create. Refs #2619. 2015-03-03 17:02:12 +01:00
Aider Ibragimov
e5d95e319e fix FilePathField kwargs for django < 1.5 2015-03-03 16:58:04 +03:00
Aider Ibragimov
04cc1964bd remove dict compehension 2015-03-03 16:45:20 +03: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
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
313b3d7c3b Update ModelSerializer mappings 2015-02-28 10:18:47 +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
Janusz Harkot
9098856d46 fix DictKey initial value 2015-02-27 19:46:36 +01:00
Ian Foote
32c885c2a0 Ensure validators are new-style classes on python2 2015-02-27 15:22:19 +00: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
e6b06c34c1 Add explanation for this exception mutation 2015-02-26 09:20:17 -08:00
Evan Heidtmann
bdb73d5588 Avoid swallowing exceptions thrown in callable attributes 2015-02-26 09:05:46 -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
d219fc0d81 Merge pull request #2602 from dbrgn/fix-1602
List resource not updated between requests
2015-02-26 15:52:54 +00:00
Tom Christie
88cd86c956 Merge pull request #2587 from jpadilla/select-multiple-disabled
Disable select field if no choices available
2015-02-26 12:54:58 +00:00
Tom Christie
03818ed004 Pagination tweaks and docs 2015-02-26 12:48:34 +00:00
Danilo Bargen
86c5fa2401 Force-evaluate querysets (see #2602) 2015-02-25 18:54:47 +01:00
Yannick PEROUX
940cf2e2e0 Remove duplicated code in routers.SimpleRouter 2015-02-25 13:29:07 +01:00
Yannick PEROUX
bdc64d4e73 Fix removal of url_path on @detail_route and @list_route. Fix # #2583
SimpleRouter.get_routes was popping out the url_path kwarg from
list_route and detail_route decorators. This was causing troubles
when the route was re-used, for example if the viewset was
inherited.
2015-02-25 11:54:11 +01:00
Tom Christie
b69032f3a7 Merge pull request #2586 from rense/master
Set field max_length/max_value as actual attribute.
2015-02-21 15:31:02 +00:00
Rense VanderHoek
91416632a8 DecimalField fix
max_value and min_value are not in kwargs
2015-02-21 12:31:37 +01:00
Tymur Maryokhin
7345830c88 Check if sessions are enabled before calling logout. Closes #2545. 2015-02-20 20:12:39 +01:00
Rense VanderHoek
9cb547b85f Validator-fix, added min/max fields to test_metadata 2015-02-20 17:34:49 +01:00
José Padilla
bb8690cfb3 Disable select field if no choices available 2015-02-20 11:43:12 -04:00
Rense VanderHoek
c8609ba652 Set field length/values as actual attributes.
The SimpleMetadata class in metadata.py tries to getattr() attributes
on a field. For this to work, max_length and min_length have to be
actually set as an attribute.
Did the same for min_value and max_value and added those two to
SimpleMetadata.get_field_info
2015-02-20 16:31:12 +01:00
Rubén Durá Tarí
60617f876a Fixes HiddenField being rendered in HTMLFormRenderer 2015-02-20 07:50:15 -04: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
e45e0f0567 Update version 2015-02-17 13:44:42 +00:00
José Padilla
85bf127943 Merge pull request #2567 from carltongibson/18-warning
Move `importlib` fallback into compat.
2015-02-17 08:39:06 -04:00
Tom Christie
dbd2352165 Fixes for latest pep8 updates. Refs #2563. 2015-02-17 10:58:00 +00:00
Carlton Gibson
c5eb5b2201 Move importlib fallback into compat. 2015-02-17 11:55:15 +01:00
Carlton Gibson
daf1d59d0f Adjust importlib import 2015-02-17 11:22:37 +01:00
Tom Christie
4248a8d3fc Merge pull request #2198 from tomchristie/version-3.1
Version 3.1
2015-02-13 13:38:44 +00:00
Tom Christie
c3425accde Fix incorrect HTML parsing for DictField 2015-02-11 14:19:07 +00:00
donewell
9a9a00bff2 simplify argument handling 2015-02-11 11:15:01 +00:00
Xavier Ordoquy
637af1fc14 Merge pull request #2540 from linovia/release/3.0.5
Release/3.0.5
2015-02-10 23:48:38 +01:00
Xavier Ordoquy
59b3fe8f39 Bumped the version to 3.0.5 2015-02-10 22:48:04 +01: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
3522b69394 Add distinct call in filter_queryset 2015-02-10 10:51:38 +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
54d82f59ed Py3 compat fix 2015-02-09 17:19:22 +00:00
Tom Christie
d13c807616 Fix misleading AttributeErrors 2015-02-09 17:02:54 +00:00
Tom Christie
0240df1a38 Minor internal API cleanpu 2015-02-06 16:15:10 +00:00
Tom Christie
670723f021 Minor cleanups/improvements to ModelSerializer API 2015-02-06 15:45:02 +00:00
Tom Christie
dec3493d7c Minor cleanup 2015-02-06 14:43:43 +00:00
Tom Christie
a435b1b355 Merge branch 'version-3.1' of git://github.com/jpadilla/django-rest-framework into version-3.1 2015-02-06 14:39:31 +00:00
Tom Christie
1f99612845 Upgrade pending deprecations to deprecations 2015-02-06 13:21:35 +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
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
José Padilla
c696b0ba0c Fix possible nested array fields 2015-02-05 10:12:14 -04:00
José Padilla
720d154c83 Merge remote-tracking branch 'upstream/version-3.1' into version-3.1 2015-02-04 23:34:20 -04:00
José Padilla
48fa77c09e Add child to ListField when using ArrayField 2015-02-04 23:33:59 -04:00
Tom Christie
e1c4513312 Fix NamespaceVersioning with hyperlinked serializer fields 2015-02-05 00:58:09 +00:00
Tom Christie
83673e8f74 Merge branch 'version-3.1-2489' of git://github.com/brandoncazander/django-rest-framework into brandoncazander-version-3.1-2489 2015-02-04 23:32:48 +00: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
Tom Christie
8b4ce5c636 Minor authentication message improvement. 2015-02-04 09:07:10 +00:00
Brandon Cazander
77d061d234 Provide rest_framework.resolve. Fixes #2489 2015-02-02 20:37:33 -08: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
José Padilla
b844cc4bb6 Merge remote-tracking branch 'upstream/version-3.1' into version-3.1
Conflicts:
	rest_framework/serializers.py
2015-02-01 15:34:33 -04:00
José Padilla
37dce89354 Add support for Django 1.8’s ArrayField 2015-02-01 15:33:34 -04:00
Tom Christie
e63f49bd1d Fix field mappings for 1.8 fields 2015-01-31 19:59:52 +00:00
Tom Christie
2cc4cb2465 Fix error text in test. 2015-01-31 08:53:40 +00:00
Tom Christie
53b29f0902 _closable_objects as an empty list, not deleted 2015-01-31 08:27:17 +00:00
Tom Christie
6838f17325 Add built-in translations. 2015-01-30 16:41:21 +00:00
Tom Christie
0d96cf2ca2 Latest translation source messages. 2015-01-30 16:27:49 +00:00
José Padilla
760b25bc20 Fix AttributeError on renamed _field_mapping 2015-01-30 11:36:03 -04: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
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
Brandon Cazander
ac87490b91 Clone the versioning_scheme when necessary. Fixes #2477 2015-01-27 17:10:17 -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
Brandon Cazander
bf58c1265d Set a version attribute on cloned requests if necessary. 2015-01-26 22:56:57 -08:00
Brandon Cazander
ed04725822 Use enhanced request when cloning requests for checking permissions on other methods. Fixes #2455 2015-01-24 01:44:40 -08: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
8f25c0c53c Add 1.8 support 2015-01-23 14:56:15 +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
25a703b42c Work around meta API differences 2015-01-23 11:15:11 +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
38a2ed6f62 Python 3 fixes for cursor pagination 2015-01-22 14:04:25 +00:00
Tom Christie
ca372ef6ef Fix for python 3 2015-01-22 13:50:51 +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
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
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
3cc39ffbce NotImplemented -> NotImplementedError 2015-01-19 15:22:38 +00:00
Tom Christie
6065cdbd93 Merge master 2015-01-19 15:16:57 +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
Tom Christie
4f3c3a06cf Drop trailing whitespace on indented JSON output. Closes #2429. 2015-01-19 14:41:10 +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
dbb684117f Add offset support for cursor pagination 2015-01-19 09:24:42 +00:00
Tom Christie
492f3c410d Cleaning up cursor implementation 2015-01-17 00:59:02 +00: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
53edd37df5 Tests for LimitOffsetPagination 2015-01-15 21:07:05 +00:00
Tom Christie
68dfa369b5 Flake 8 fixes 2015-01-15 16:55:04 +00:00
Tom Christie
d76e83dd78 Tweaks, and add pagination controls for offset/limit. 2015-01-15 16:52:07 +00:00
Tom Christie
313aa727e3 Tweaks 2015-01-14 17:46:41 +00:00
Tom Christie
3833a5bb8a Include pagination control in browsable API 2015-01-14 16:51:26 +00:00
Tom Christie
f13fcba9a9 Include paragraph around view description in browable API 2015-01-14 13:20:02 +00:00
Tom Christie
4d287c7aef Include paragraph around view description in browable API 2015-01-14 13:19:56 +00:00
Tom Christie
4ce4132e08 Preserve ordering on relationship drop-down choices. Closes #2408. 2015-01-14 12:56:03 +00:00
Tom Christie
1bcec3a0ac API tweaks and pagination documentation 2015-01-13 17:14:13 +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
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
Xavier Ordoquy
02ee3871ae Merge remote-tracking branch 'origin/master' into release/3.0.3 2015-01-08 23:24:19 +01:00
Craig Blaszczyk
1368c31a70 remove unused import 2015-01-08 17:16:15 +00: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
Craig Blaszczyk
734f8f2667 restore Django 404 2015-01-07 18:22:40 +00:00
Craig Blaszczyk
58ec7669ae swap backticks for double quotes 2015-01-07 18:22:30 +00:00
Xavier Ordoquy
b7015ea898 Bumped the version to 3.0.3. 2015-01-07 19:11:17 +01: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
Craig Blaszczyk
9a4267049b use double quotes in user messages 2015-01-07 12:33:37 +00:00
Craig Blaszczyk
662a907bdf update source strings 2015-01-07 12:02:04 +00:00
Craig Blaszczyk
4c32083b8b use double quotes for user visible strings; end user visible strings in full stops; add some missing translation tags 2015-01-07 12:01:11 +00:00
Craig Blaszczyk
fe5d93c8cb remove hardcoded page number 2015-01-07 11:44:18 +00:00
Craig Blaszczyk
3819ae35ac recompile pofile with new python format strings 2015-01-07 11:42:36 +00:00
Craig Blaszczyk
9b4177b6ea switch to using format strings in error messages; raise NotFound when pagination fails to provide a more useful error message 2015-01-07 11:41:06 +00: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
949e3b7507 Merge branch 'master' into version-3.1 2015-01-05 15:04:23 +00:00
Tom Christie
6fd33ddea9 Udpate docstring 2015-01-05 15:04:01 +00:00
Tom Christie
49dc037a96 Update docstring 2015-01-05 15:03:09 +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
Tom Christie
8cf3744971 Ensure no invalid min_length/min_value/max_value arguments. Closes #2369. 2015-01-05 10:52:18 +00:00
Craig Blaszczyk
6fb37207d1 add missing period; update generated translations 2015-01-02 11:11:13 +00:00
Craig Blaszczyk
a90ba2bc11 update error messages for language and consistency 2015-01-02 11:08:31 +00:00
Craig Blaszczyk
faf76a4b75 fix spelling & grammar errors 2015-01-02 11:08:09 +00:00
Craig Blaszczyk
0b8a83bd62 update internationalisation instructions to prevent symlinking; add base .po file 2015-01-02 11:08:04 +00:00
Kyle Valade
a7479721c8 First pass at refactoring get_field_info in utils.model_meta 2014-12-29 00:35:00 -08:00
Tom Christie
5d8c45681a Update copryright for 2015. Closes #2247. 2014-12-28 18:48:42 +00:00
Tom Christie
efa5942ce1 Support namespaced router URLs with DefaultRouter. 2014-12-28 12:02:52 +00:00
Tom Christie
ef2eff2aba Only pass max_length for CharField. Closes #2317. 2014-12-28 11:07:38 +00:00
Tom Christie
c2e00a075c Paginated serializers should get context. 2014-12-26 15:25:13 +00:00
Tom Christie
9f9b9f8944 Merge pull request #2340 from shtouff/fix-htmlform-textarea
Use textarea input for 'models.TextField'.
2014-12-24 14:44:32 +00:00
Andrew Seier
35768344db Remove ‘/‘ from inside variable block {{ }}
manage.py compress —force causes a warning here.
2014-12-23 12:12:22 -08:00
Andrew Seier
399cb165b0 Remove commented code (warning during compression)
manage.py compress —force causes a warning here.
2014-12-23 12:11:45 -08:00
Remi Paulmier
6c5ff71278 fix the way to use textarea rather than input with models.TextField 2014-12-22 18:05:07 +01:00
Tom Christie
e4c7c10b00 Merge pull request #2331 from tomchristie/use-custom-list-serializer-for-pagination
Use custom ListSerializer for pagination if required.
2014-12-20 16:42:39 +00: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
03c4eb1130 Use custom ListSerializer for pagination if one is specified on the serializer. 2014-12-20 16:32:07 +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
Tom Christie
62f78dfbf1 Copy validators lists on instantiation. 2014-12-19 15:50:29 +00:00
Tom Christie
75e81b8254 build_*_field methods 2014-12-19 15:35:52 +00:00
Tom Christie
f72928ea98 build_field, build_final_kwargs 2014-12-19 15:09:57 +00:00
Tom Christie
94883ae7cd Merge branch 'version-3.1' into model-serializer-api 2014-12-19 14:53:21 +00:00
Tom Christie
3fc441059d Merge branch 'master' into version-3.1 2014-12-19 14:53:10 +00:00
Tom Christie
80bacc5fb0 depth should reduce by one on each nesting level. Closes #2287. 2014-12-19 14:52:53 +00:00
Tom Christie
4a112fc3a6 Clean up 2014-12-19 14:51:45 +00:00
tanwanirahul
92ebeaa040 Change decorator attribute name to url_path per suggestions 2014-12-19 19:52:59 +05:30
Tom Christie
caa1318124 get_uniqueness_field_options first pass 2014-12-19 13:13:20 +00:00
Tom Christie
1a84943a00 get_extra_kwargs 2014-12-19 12:27:50 +00:00
Tom Christie
6d907cde9a get_field_names, get_default_field_names 2014-12-19 12:18:40 +00:00
Tom Christie
ba753a7536 Merge branch 'version-3.1' into model-serializer-api 2014-12-19 11:53:26 +00:00
Tom Christie
435aef7738 Merge branch 'master' into version-3.1 2014-12-19 11:53:05 +00:00
Tom Christie
5830f7e138 get_unique_together_validators and get_unique_for_date_validators 2014-12-19 10:15:36 +00:00
Tymur Maryokhin
d60ecfc498 Assert fields in exclude are model fields 2014-12-18 16:03:15 +01:00
Tom Christie
a68d9331fc YAML encoder fix for 3.0 serializers. 2014-12-18 12:17:46 +00:00
Tom Christie
c8d88c8c8a Merge branch 'master' into version-3.1 2014-12-18 11:21:25 +00:00
Tom Christie
87ac64e41b Fixes for behavior with empty HTML fields. 2014-12-18 10:36:52 +00:00
Tom Christie
15c2001de0 Merge pull request #2297 from tomchristie/version-3.0.2
Version 3.0.2
2014-12-17 21:04:08 +00:00
Tom Christie
bbd55fafc5 Version 3.0.2 2014-12-17 15:58:30 +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
426547c61c str() -> six.text_type(). Closes #2290. 2014-12-17 13:39:35 +00:00
Tom Christie
65fc0d0f77 Ensure request.auth is available to response middleware. 2014-12-17 13:22:52 +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
70bd3a32f7 Minor comment tweak 2014-12-16 20:01:01 +00:00
Tom Christie
fe9647ce92 AcceptHeaderVersioning to return unicode strings. 2014-12-16 16:37:32 +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
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
af53e34dd5 Merge pull request #2279 from tomchristie/fix-serializer-repr-unicode-bug
Use unicode internally everywhere for 'repr'.
2014-12-15 12:04:46 +00:00
Tom Christie
dc66cce16d Remove erronous print 2014-12-15 12:01:29 +00:00
Tom Christie
72e08a3e8b Use unicode internally everywhere for 'repr' 2014-12-15 11:55:17 +00:00
Tom Christie
488b13e7b8 Better messaging for 'Field.to_representation'. Closes #2271. 2014-12-15 09:29:54 +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
d232c5739e Merge branch 'exception-handler-context' of git://github.com/jpadilla/django-rest-framework into version-3.1 2014-12-15 09:19:53 +00:00
Tom Christie
4778463e32 Merge branch 'master' into version-3.1 2014-12-15 09:18:11 +00:00
Tom Christie
d22c0007b3 Merge branch 'exception-handler-context' of git://github.com/jpadilla/django-rest-framework into jpadilla-exception-handler-context 2014-12-15 09:13:27 +00:00
Tom Christie
5e7c9687c7 First pass at serializer repr bug 2014-12-15 09:13:02 +00:00
José Padilla
4ebd8770b9 Update excepteion_handler signature 2014-12-14 20:47:33 -04:00
José Padilla
26c223a34f Add get_exception_handler_context() 2014-12-14 16:43:58 -04:00
José Padilla
89e9fc98d6 Reuse exception_handler variable throughout 2014-12-14 15:20:44 -04:00
José Padilla
fd003fcefa Add pending deprecation warning message 2014-12-14 15:03:20 -04:00
José Padilla
e8c0766568 Support handlers with and without context 2014-12-13 20:54:35 -04:00
José Padilla
0d109c90a7 Add context to exception handler #2236
Same context as renderers which include: the view,
args, kwargs, and request.

This provides enough contextual information to the
exception handlers to handle errors better.

In a use case like #1671, a custom handler
would allow Sentry to log the request properly.
2014-12-13 18:18:00 -04:00
Tom Christie
dd712a1c26 Merge pull request #2267 from tomchristie/better-misconfigured-serializer-errors
Better errors when serializer has incorrectly named field.
2014-12-13 15:08:36 +00:00
Tom Christie
aa571abb20 Better errors when serializer has incorrectly named field. 2014-12-13 14:58:04 +00:00
Tom Christie
c0b9115bec Improve check for nested writes 2014-12-13 14:17:24 +00:00
Tom Christie
baaa356489 Merge master 2014-12-12 15:37:43 +00:00
Tom Christie
78312d44d1 Client.logout() also clears any force_authenticate 2014-12-12 13:13:08 +00:00
Peter Schmidt
fa1ef33bfc Update CharField default min_length message. 2014-12-12 11:16:29 +11:00
Tom Christie
73a80564e2 Merge pull request #2251 from linovia/version/3.0.1
Release notes & version 3.0.1
2014-12-11 15:08:07 +00:00
Xavier Ordoquy
4aaab08e13 Version 3.0.1 2014-12-11 00:09:11 +01:00
Tom Christie
313c36faca Merge pull request #2242 from tomchristie/hyperlinked-pk-optimization
Hyperlinked PK optimization.
2014-12-10 22:19:46 +00:00
Tom Christie
1e336ef30d Move comment 2014-12-10 22:10:45 +00:00
Tom Christie
9d3810f313 Drop get_iterable() 2014-12-10 22:09:24 +00:00
Tom Christie
ca7b1f6d51 Optimizations play nicely with select_related, prefetch_related 2014-12-10 21:09:45 +00:00
Tom Christie
fb313f8098 Merge pull request #2241 from IvanAlegre/patch-1
Update serializers.py
2014-12-10 09:27:58 +00:00
Tom Christie
81d0b748b4 Improve field lookup behavior for dicts/mappings. Closes #2244. Closes #2243. 2014-12-10 09:16:01 +00:00
J. Iván Alegre
428630c197 Fix trailing space 2014-12-10 10:13:15 +01:00
J. Iván Alegre
9161e5a927 Remove unnecessary hasattr all and add comment for nested relationships 2014-12-10 09:19:27 +01:00
Tom Christie
720a37d3de Hyperlinked PK optimization. Closes #1872. 2014-12-09 17:28:56 +00:00
J. Iván Alegre
59470667db Take in care that input data in serializer can be a Manager 2014-12-09 17:49:07 +01:00
Tom Christie
7d70e56ce3 Copy model field validators, don't reuse the same list. 2014-12-09 16:25:10 +00:00
Julio Iván Alegre
8d6b0b1f2d Update serializers.py
Treat the input queryset as it comes (maybe it has been changed in a higher level). Evaluating .all() does nothing if or if not is a queryset.
2014-12-09 16:13:18 +01: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
41bfdc0732 Don't use 'instance' argument in rendering form for paginated data. Closes #2205. 2014-12-08 21:56:06 +00:00
Tom Christie
4034793383 Added missing translation markers in realtions.py. Closes #2231. 2014-12-08 15:13:59 +00:00
Tom Christie
eee02a47d9 Added ListSerializer.validate(). Closes #2168. 2014-12-08 14:56:45 +00:00
Loic Bistuer
b90f4228b2 Ported a couple of templates to Bootstrap 3.x. 2014-12-08 09:06:52 +07:00
Loic Bistuer
ff02a0af9c Fixed display issues with tooltips. 2014-12-08 09:06:52 +07:00
Xavier Ordoquy
a257b04928 Fix missing validated_data in raise_errors_on_nested_writes (#2221) 2014-12-07 12:12:40 +01: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
88900a0844 Minor tweaks 2014-12-05 13:58:39 +00:00
Tom Christie
ca74fa989d Better serializer errors for nested writes. Closes #2202 2014-12-05 13:50:28 +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
45dc44b203 Merge branch 'master' of github.com:tomchristie/django-rest-framework 2014-12-04 20:57:27 +01:00
Tymur Maryokhin
001884a192 Removed unused compat code 2014-12-04 16:06:43 +01:00
Tymur Maryokhin
95af92ca01 Removed custom urlparse compat 2014-12-04 15:47:42 +01:00
Tom Christie
e8cbf41bd9 Merge pull request #2172 from kchange/master
Added missing default style for FileField
2014-12-04 07:47:53 +00: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
f221b737a1 Merge pull request #2197 from mtschammer/mtschammer-validated_attrs-rename
Renamed validated_attrs to validated_data to be more in line with other code
2014-12-03 23:01:30 +00:00
Kevin Brown
66bce38b59 Merge pull request #2196 from tomchristie/tomchristie-improve-update-nested-validation
Improve checks for nested creates and updates.
2014-12-03 17:57:47 -05:00
Martin Tschammer
ab25d706c7 Renamed validated_attrs to validated_data to be more in line with other similar code. 2014-12-03 23:52:35 +01:00
Tom Christie
e1d98f7756 Improve nested update and create testing. 2014-12-03 22:45:44 +00:00
Tom Christie
f2dd05a6e6 Improved nested update test in update().
Closes #2194.
2014-12-03 22:43:40 +00:00
Tom Christie
23fa6e54ce Escape \u2028 and \u2029 in JSON output.
Closes #2169.
2014-12-03 22:33:34 +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
33096a1de6 BindingDict inherits from collections.MutableMapping. Closes #2135. 2014-12-02 15:15:21 +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
Tom Christie
79e18a2a06 Raise assertion error if calling .save() on a serializer with errors. Closes #2098. 2014-12-02 09:27:40 +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
Tom Christie
270c7acdd7 Minor validtors tweak 2014-12-01 11:59:04 +00:00
Tom Christie
22c5b863bc More descriptive docstring on ModelSerializer 2014-12-01 11:37:38 +00:00
Tom Christie
b9503cd603 Support Django's core ValidationError for backwards compat. Refs #2145. 2014-12-01 10:48:45 +00: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
José Padilla
731c8421af Remove YAML support from core 2014-11-29 14:43:05 -04:00
Martin Maillard
85c96bb574 Set user on wrapped request 2014-11-28 21:12:27 +01: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
08c727add3 @api_view defaults to allowing GET 2014-11-28 15:55:02 +00: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
Tymur Maryokhin
d9a09f7826 Removed unused import 2014-11-28 13:33:07 +01:00
Tymur Maryokhin
0539b1be01 Update token auth view. Closes #2151. 2014-11-28 12:27:05 +01:00
Tom Christie
d4b8e356b9 Merge branch '3.0-docs' 2014-11-28 09:57:02 +00:00
Tom Christie
34ca8cd2a5 Moar docs. Amazing. 2014-11-28 09:56:44 +00:00
Tom Christie
d2d7e1dfde Drop Field.validate 2014-11-27 16:41:53 +00:00
Tom Christie
6b2033f789 Drop transform_<field_name> 2014-11-27 16:40:58 +00:00
Tom Christie
8579222cbd Fix for nested attribute lookups where one is a callable 2014-11-27 15:14:11 +00:00
Tom Christie
1ffe4857ec Support callable attributes in dotted source. Closes #2142. 2014-11-27 08:10:52 +00:00
Xavier Ordoquy
f5e5ed0077 Merge remote-tracking branch 'reference/master' into bugfix/1850 2014-11-26 16:36:56 +01:00
Tom Christie
786cab705a Tweak to 3.0 relationship docs 2014-11-26 11:38:48 +00:00
Tom Christie
b4550c65dd Docstring for 'many_init' 2014-11-26 11:30:28 +00:00
Tom Christie
2e726e22a3 request.DATA, request.FILES -> request.data 2014-11-25 11:42:43 +00:00
Tom Christie
06fd63dade Don't use default_empty_html value for partial updates. Closes #2118. 2014-11-25 11:14:28 +00:00
Tom Christie
fd980be39b Documentation in 'many_init' docstring. Refs #2120. 2014-11-25 10:39:58 +00:00
Tom Christie
ecc26f6cb1 Style tweaks to login template. 2014-11-25 09:07:25 +00:00
Tom Christie
735d2257b4 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2014-11-25 08:59:59 +00:00
Tom Christie
bdacb66244 Lowercase HTML label tag. Refs #2121. 2014-11-25 08:59:45 +00:00
Andreas Bernacca
2ec0e7417f removed the whole footer section 2014-11-21 22:45:28 +01:00
Andreas Bernacca
fe9a758d7e remove sponsored by dabapps 2014-11-21 22:15:43 +01:00
Tom Christie
5b671cb515 Fix rendering HTML form when API error raised. Closes #2103. 2014-11-20 16:14:51 +00:00
Tom Christie
1aa58d16be Py3 fix - .items is not a list. 2014-11-20 14:26:40 +00:00
Tom Christie
6ec96d0bac Resolve PUT and POST buttons in browsable API 2014-11-20 13:43:38 +00:00
Tom Christie
9c6bead8b6 Add --- null option for selects. Closes #2096. 2014-11-20 12:38:08 +00:00
Tom Christie
6794b3380a Fixes for defaulting empty HTML fields to '', None, or empty. 2014-11-20 12:15:33 +00:00
Tom Christie
7d417fc678 Make _force_text_recursive private. 2014-11-20 12:02:58 +00:00
Tom Christie
bde7255413 Fix non-determanistic default bug. Closes #2099. 2014-11-20 09:30:49 +00:00
Tom Christie
40b1ea919b Fix non-determanistic unique constraint mapping. Refs #2092. 2014-11-19 14:51:49 +00:00
Tom Christie
8516281078 Minor fix for #2092. 2014-11-19 14:40:30 +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
6cb6510132 Use translatable error strings. Refs #2063. 2014-11-19 12:15:05 +00:00
Tom Christie
e49d22dbda Allow blank choices to render. Closes #2071. 2014-11-19 09:31:26 +00:00
Tom Christie
f573aaee4e List serializer no explicitly renders as 'not supported for HTML input' 2014-11-18 17:25:05 +00:00
Tom Christie
c0d356edaa Fix byte decode error rendering 'display_name' with OPTIONS. Closes #2084 2014-11-18 15:42:52 +00:00
Tom Christie
080bd3d24e Add comment ref #2089 2014-11-18 15:38:31 +00:00
Tom Christie
084354d3eb Only pass instance to form for PUT and PATCH. Closes #2073. 2014-11-18 15:11:40 +00:00
Tom Christie
5e74f02d61 Note removal of 'save_object' and fail loudly if it exists 2014-11-18 14:49:00 +00:00
Doug Beck
67735687b2 Ensure _resolve_model does not return None 2014-11-18 01:26:23 -05:00
Tom Christie
0f508c5821 Docs for advanced default argument usage. Closes #1945 2014-11-17 18:36:32 +00:00
Tom Christie
5f580cad52 Remove class='form-control' for file inputs. Closes #2065. 2014-11-17 18:17:44 +00: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
4e03518438 required=False for nullable relationships 2014-11-13 23:30:42 +00:00
Tom Christie
7394dcec9e ReturnList and ReturnDict wrapped at nicer point 2014-11-13 23:05:44 +00:00
Tom Christie
cb672a0ecb Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2014-11-13 22:16:53 +00:00
Tom Christie
992330055e Refactor many 2014-11-13 21:11:13 +00:00
Tom Christie
78a741be27 Split out .create and .update on ListSerializer 2014-11-13 20:24:48 +00:00
Tom Christie
fd97d9bff8 Use select inputs for relationships. Closes #2058. 2014-11-13 19:35:03 +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
Kevin Chang
dbb435ca31 Added missing default style for FileField 2014-11-12 12:46:09 -08:00
Tom Christie
e70b82b6c8 Update html.py 2014-11-12 15:38:39 +00:00
Tom Christie
1838e18aee Update html.py 2014-11-12 15:38:05 +00:00
Kevin London
9521b69711 #2054: Update exceptions to allow custom detail
This addresses the changes requested in #2054 and allows for custom messages that do not necessarily require a string formatter be present in the detail message.
2014-11-10 11:08:39 -08:00
Tom Christie
62ce653c61 Update fields.py 2014-11-10 14:44:26 +00:00
Tom Christie
fd7db776ad Bring UniqueValidator implementation in line with other uniquness validators. 2014-11-10 12:32:03 +00:00
Tom Christie
f387cd89da Uniqueness constraints imply a forced 'required=True'. Refs #1945 2014-11-10 12:21:27 +00:00
Tom Christie
51d86a6505 Support dotted source on relational fields 2014-11-07 16:05:07 +00:00
Tom Christie
3e878a3207 Fix initial data on serializers to reflect writable fields 2014-11-07 15:38:27 +00:00
Tom Christie
02844a1507 Fix up fieldset templates. Closes #2039 2014-11-07 15:22:17 +00:00
Tom Christie
4e2627736f Merge branch 'master' into dont-deserialize-twice 2014-11-07 14:14:18 +00:00
Tom Christie
55c44fc921 Fix serializer initial data 2014-11-07 14:13:50 +00:00
Tom Christie
041435f4ee Prevent re-running deserialization. Closes #1975. 2014-11-07 14:08:20 +00:00
Tom Christie
bb21216a7c Metadata API should examine child serializer if passed parent ListSerializer. Closes #2035. 2014-11-07 12:16:25 +00:00
Tom Christie
eafb7e1e24 ModelField fix. Closes #2018. 2014-11-07 11:44:16 +00:00
Tom Christie
a16a8a10a9 .copy() for serializer .data and .errors dictionaries 2014-11-07 11:16:26 +00:00
Tom Christie
e399140031 Minor tweaks 2014-11-07 10:51:08 +00:00
Tom Christie
555930ee81 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2014-11-07 10:14:03 +00:00
Tom Christie
9b19b5a594 Serializer cleanup 2014-11-07 10:13:46 +00:00
Tom Christie
a40b805963 Merge pull request #2038 from NextHub/master
Fixed base_url duplication in FileField.use_url
2014-11-06 17:37:52 +00:00
Tom Christie
db1dd8e240 Tests & fixes for list serialization 2014-11-06 17:32:33 +00:00
Tymur Maryokhin
ea76dc18b6 Fixed base_url duplication in FileField.use_url
Django already joins base_url when constructing FileField.url
2014-11-06 18:20:55 +01:00
Tom Christie
4e001dbb7a Drop usage of SortedDict. Closes #2027. 2014-11-06 12:00:30 +00:00
Tom Christie
a919068c5d Fix exception style for py3 2014-11-06 11:35:34 +00:00
Tom Christie
4482be46ae More precise assertion error for bulk update 2014-11-06 11:10:36 +00:00
Tom Christie
ed541864e6 Support for bulk create. Closes #1965. 2014-11-06 10:34:59 +00:00
Tom Christie
73daf40715 ModelField should support max_length. Closes #2018. 2014-11-05 15:51:45 +00:00
Tom Christie
49fae23000 Pass through kwargs to both Serializer and ListSerializer 2014-11-05 15:23:13 +00:00
Tom Christie
d048d32876 Minor cleanup 2014-11-05 13:40:21 +00:00
Tom Christie
2daf085100 Copy accepted_renderer and accepted_media_type when cloing a request. Closes #1950. 2014-11-05 11:08:32 +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
26b6180f50 Support None if initial part of dotted lookup returns None. Closes #1223. 2014-11-05 10:28:34 +00:00
Aron Jones
4d3831cae8 add glyphicons font files 2014-11-04 22:01:23 -05:00
Tom Christie
003c42b0f5 Use invalid_data key for error message. Closes #2002. 2014-11-03 14:01:02 +00:00
tanwanirahul
6a095e9110 Merge remote-tracking branch 'rahul/master' 2014-11-03 14:45:49 +01:00
tanwanirahul
d972df7c9c Ability to override default method names by customizing it 2014-11-03 14:43:53 +01:00
Tom Christie
d27b8cc09b PUT as create docs, and move mixin out to external gist 2014-11-03 12:00:19 +00:00
Tom Christie
37845968cd Merge master 2014-11-03 11:39:54 +00:00
Tom Christie
650a91ac24 Fix URL escaping 2014-11-03 11:29:48 +00:00
Tom Christie
96bb77dc35 Version 2.4.4 2014-11-03 11:20:18 +00:00
Tom Christie
ddc177732c Merge branch 'master' into version-3.0 2014-11-03 11:10:47 +00:00
Tom Christie
b5c98f686d Properly escape URLs when replacing query parameter 2014-11-03 11:10:24 +00: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
5e1ed0aa95 Merge pull request #1922 from JonesChi/fix_follow
Fix follow does not work on get of APIRequestFactory
2014-10-31 16:05:17 +00:00
Tom Christie
bacf8cfa9d Guard against malicious string inputs for numbers. Closes #1903. 2014-10-31 15:41:00 +00:00
Tom Christie
0b864acd98 Merge pull request #1785 from gdoermann/master
Frameworks throws AssertionError saying you cannot set required=True and...
2014-10-31 15:29:06 +00:00
Tom Christie
159c3de9fc Merge master 2014-10-31 15:19:15 +00:00
Tom Christie
45b5f23f31 Update to bootstrap 3. Closes #1085 2014-10-31 14:56:41 +00:00
Tom Christie
2762205887 Validator documentation and tweaks 2014-10-31 13:47:36 +00:00
Tom Christie
cd40dcb065 Ensure json.dumps(separators=...) works on both 2.x and 3.x 2014-10-30 16:53:12 +00:00
Tom Christie
9ebaabd6eb unique_for_date/unique_for_month/unique_for_year 2014-10-28 16:21:49 +00:00
Tom Christie
f9c0e6ee1b unique_for_month, unique_for_year 2014-10-22 16:29:09 +01: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
Erik Wickstrom
674855a114 Used Django utils SortedDict instead of stdlib's OrderedDict for
wider compatability.
2014-10-20 08:47:45 -07:00
Erik Wickstrom
12b677039d Maintain order of views on router for api root view. 2014-10-19 21:03:33 -07: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
5882a7a9d5 Tweak 2014-10-16 20:47:57 +01:00
Tom Christie
3af5df1955 Performance for PK fields 2014-10-16 20:47:57 +01:00
Tom Christie
32fd82ba0d get_attribute method on fields 2014-10-16 20:47:57 +01:00
Tom Christie
7b666e982c Stricter checking for failure cases. 2014-10-16 20:47:57 +01:00
Marty Alchin
4248a6c499 Add a keys method to BindingDict 2014-10-15 17:54:58 -07:00
Tom Christie
b4f3379c70 Support fields that reference a simple callable 2014-10-15 15:13:28 +01:00
Tom Christie
e8ea365c15 Moar form styling 2014-10-15 15:11:01 +01:00
Tom Christie
36fbc7678c Moar form styling 2014-10-15 13:35:12 +01:00
Tom Christie
cc1c423255 Reorganize to use template_pack in form rendering 2014-10-15 11:12:34 +01:00
Tom Christie
e558f806c0 Drop template includes 2014-10-15 10:04:01 +01:00
Tom Christie
faa5bd9f53 Merge branch 'version-3.0' of https://github.com/tomchristie/django-rest-framework into version-3.0 2014-10-15 09:25:02 +01:00
Tom Christie
e272a36c9b Fix 'lookup_field' on ModelSerializer. Closes #1944. 2014-10-15 09:24:49 +01:00
Andy Freeland
81abf2bf34 Rename preform_update to perform_update 2014-10-12 01:19:53 -04:00
Tom Christie
826b5a8897 Relations in 'read_only_fields' should not include a queryset kwarg 2014-10-10 15:34:00 +01:00
Tom Christie
b5a4216aff Flake8 2014-10-10 15:08:43 +01:00
Tom Christie
d8a8987ab1 Tweaks 2014-10-10 14:32:02 +01:00
Tom Christie
d9a199ca0d exceptions.ValidationFailed, not Django's ValidationError 2014-10-10 14:16:09 +01:00
Tom Christie
a0e852a4d5 Use BoundField .name on fields 2014-10-09 16:30:06 +01:00
Tom Christie
f83ed19d22 Checks and repr on BoundField 2014-10-09 16:29:34 +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
87fdc73f64 Merge pull request #1920 from thedrow/topic/encoder-improvements
The JSON encoder now uses tuples instead of lists
2014-10-09 08:31:46 +01:00
Tom Christie
f7d43f530a Limit blank string -> None to just be on relational fields 2014-10-08 17:03:14 +01:00
Tom Christie
5ead8dc89d Support empty file fields 2014-10-08 16:59:52 +01:00
Tom Christie
4c015df28c Tweaks 2014-10-08 16:43:33 +01:00
Tom Christie
14ae52a24e More gradual deprecation 2014-10-08 16:09:37 +01:00
Tom Christie
28f3b314f1 .validate() returning validated data. transform_<field> hooks. 2014-10-08 12:36:28 +01:00
Tom Christie
0cbb57b40f Tweak pre/post save hooks. Return instance in .update(). 2014-10-08 12:17:30 +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
3fa4a1898a Reintroduce save hooks 2014-10-07 17:21:12 +01: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
Tom Christie
3a3e2bf57d Serializer.save() takes keyword arguments, not 'extras' argument 2014-10-03 13:42:06 +01:00
Tom Christie
e6c5ebdda6 Fix indentation 2014-10-03 13:14:17 +01:00
Tom Christie
01c0857f8b Merge branch 'version-3.0' of https://github.com/tomchristie/django-rest-framework into version-3.0 2014-10-03 13:12:43 +01:00
Tom Christie
765b0b33bf Revert accidental stupidity 2014-10-03 13:12:23 +01:00
Tom Christie
dd47d8aa45 Merge pull request #1921 from koordinates/fix-typos
Minor: fix spelling and grammar, mostly in 3.0 announcement
2014-10-03 09:24:26 +01: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
fec7c4b458 Browsable API tweaks 2014-10-02 18:13:15 +01:00
Tom Christie
df7b6fcf58 First pass on incorperating the form rendering into the browsable API 2014-10-02 16:24:24 +01:00
Omer Katz
79e91dff92 The encoder now returns tuples instead of lists.
Tuples take a little less memory which is significant when serializing a lot of objects.
2014-10-02 16:44:20 +03:00
Tom Christie
ffc6aa3abc More forms support 2014-10-01 21:35:27 +01:00
Tom Christie
c171fa21ac First pass at HTML form rendering 2014-10-01 19:44:46 +01:00
Tom Christie
c630a12e26 Deal with lazy strings in serializer reprs 2014-10-01 13:24:47 +01:00
Tom Christie
381771731f Use six.text_type instead of str everywhere 2014-10-01 13:09:14 +01:00
Tom Christie
d1b2c8ac7f Absolute URLs for file fields 2014-09-29 14:12:26 +01:00
Tom Christie
d2d412993f .validate() on serializer fields 2014-09-29 11:24:21 +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
6090144608 Simplify serialization slightly 2014-09-26 14:32:44 +01:00
Tom Christie
33ccf40b76 Update version number 2014-09-26 13:14:08 +01:00
Tom Christie
2e87de0143 Added ListField 2014-09-26 13:08:20 +01:00
Anton D. Kachalov
802913d5e4 [templates/rest_framework/base.html] Separate object-form' and generic-content-form' IDs for POST and PUT forms
Signed-off-by: Anton D. Kachalov <mouse@yandex-team.ru>
2014-09-26 16:07:46 +04:00
Tom Christie
8b8623c5f8 Allow many, partial and context in BaseSerializer 2014-09-26 12:48:20 +01:00
Tom Christie
43e80c74b2 Release notes 2014-09-26 11:56:29 +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
3a5335f09f Fix syntax error 2014-09-25 13:12:02 +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
b22c9602fa Automatic field binding 2014-09-25 11:04:18 +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
127c0bd3d6 Custom deepcopy on Field classes 2014-09-24 20:25:59 +01:00
Tom Christie
630d472055 Merge branch 'master' into version-3.0 2014-09-24 14:10:00 +01:00