Commit Graph

135 Commits

Author SHA1 Message Date
Jameel Al-Aziz
15c613a9eb
Allow generic requests, responses, fields, views (#8825)
Allow Request, Response, Field, and GenericAPIView to be subscriptable.
This allows the classes to be made generic for type checking.

This is especially useful since monkey patching DRF can be problematic
as seen in this [issue][1].

[1]: https://github.com/typeddjango/djangorestframework-stubs/issues/299
2023-02-22 21:39:01 +06:00
Ryan P Kilby
e275b9036a
Allow context to be provided to get_serializer (#7298)
* Test generics serializer behavior

* Allow context to be provided to get_serializer
2020-04-29 11:19:44 +01:00
Carlton Gibson
0407a0df8a
Dropped Python 2 compatibility. (#6615)
Thanks to Jon Dufresne (@jdufresne) for review.

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Co-authored-by: Rizwan Mansuri <Rizwan@webbyfox.com>
2019-04-30 17:53:44 +02:00
Nabil Jamaleddine
cdb8a3c3c8 Add ValidationError to except in get_object_or_404 for django 1.11 2017-05-05 21:17:12 -04:00
Stephan Groß
a101251a2a Fix blank lines around docstrings 2016-03-17 11:06:47 +00:00
José Padilla
7351a3f6ca Sort imports with isort 2015-06-25 16:55:51 -04:00
José Padilla
83c9136c90 Cleanup import following PEP 8 style guide 2015-06-25 16:10:17 -04:00
Tom Christie
8b0f25aa0a More pagination tests & cleanup 2015-01-16 16:55:46 +00:00
Tom Christie
d76e83dd78 Tweaks, and add pagination controls for offset/limit. 2015-01-15 16:52:07 +00:00
Tom Christie
1bcec3a0ac API tweaks and pagination documentation 2015-01-13 17:14:13 +00:00
Tom Christie
73feaf6299 First pass at 3.1 pagination API 2015-01-09 15:30:36 +00:00
Craig Blaszczyk
1368c31a70 remove unused import 2015-01-08 17:16:15 +00:00
Craig Blaszczyk
734f8f2667 restore Django 404 2015-01-07 18:22:40 +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
Craig Blaszczyk
9a4267049b use double quotes in user messages 2015-01-07 12:33:37 +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
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
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
Tom Christie
c6137bbf5a Serializer API restrictions. 2014-12-17 14:14:51 +00:00
Tom Christie
381771731f Use six.text_type instead of str everywhere 2014-10-01 13:09:14 +01:00
Tom Christie
2859eaf524 request.data attribute 2014-09-26 10:46:52 +01:00
Tom Christie
f4b1dcb167 OPTIONS support 2014-09-24 14:09:49 +01:00
Tom Christie
250755def7 Clean up relational fields queryset usage 2014-09-12 10:59:51 +01:00
Tom Christie
a751871991 no longer tightly coupled to private queryset API 2014-09-11 20:50:26 +01:00
Tom Christie
55650a743d no longer tightly coupled to private queryset API 2014-09-11 20:49:10 +01:00
Tom Christie
d934824bff Workin on 2014-09-05 16:29:46 +01:00
Tom Christie
4ac4676a40 First pass 2014-08-29 16:46:26 +01:00
Tom Christie
371d30aa87 Remove unused imports. 2014-08-29 12:54:52 +01:00
Tom Christie
b552b62540 get_paginate_by no longer takes optional .queryset 2014-08-29 12:54:03 +01:00
Tom Christie
ce7b2cded9 Remove deprecated generic views.
`MultipleObjectAPIView` and `SingleObjectAPIView` are no longer
required.
2014-08-29 12:48:49 +01:00
Tom Christie
72c0811576 Minor tidy up. 2014-08-29 12:48:04 +01: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
Tom Christie
b8c8d10a18 Remove page_size argument.
`paginate_queryset` no longer takes an optional `page_size` argument.
2014-08-29 11:38:54 +01:00
Tom Christie
e5e6329a22 Remove pk_url_field, slug_url_field, slug_field.
Closes #1773.
2014-08-29 11:29:26 +01:00
Tom Christie
0f8fdf4e72 Remove allow_empty.
Closes #1774.
2014-08-29 10:57:24 +01:00
Tom Christie
f62c874ea9 Remove filter_backend.
Closes #1775.
2014-08-29 10:48:40 +01:00
Tom Christie
9372cc8c31 Deprecate .model attribute on views 2014-08-20 16:24:52 +01: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
Tom Christie
e385a7b8eb Merge master 2014-08-19 10:11:10 +01:00
Tom Christie
9f3c7e8930 Copy filter_backends class attribute before returning it. 2014-08-18 15:34:23 +01:00
Tom Christie
8244c7cc33 Merge pull request #1711 from kdazzle/ModelViewSet-queryset-static-property
Issue #1707: Add documentation to api-docs.viewsets
2014-08-18 12:25:03 +01:00
Kyle
e40ffd60d4 Issue #1707 - Add documentation about the caching of GenericAPIView.queryset
to the `queryset` property, `get_queryset()`, and do generic-views.md; remove
changes to the viewsets.md documentation from my last commit.
2014-07-28 10:11:40 -07: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
khamaileon
eab5933070 Add the allow_add_remove parameter to the get_serializer method 2014-05-26 18:43:50 +02:00
Xavier Ordoquy
d08536ad9d Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts:
	.travis.yml
	docs/api-guide/fields.md
	docs/api-guide/routers.md
	docs/topics/release-notes.md
	rest_framework/authentication.py
	rest_framework/serializers.py
	rest_framework/templatetags/rest_framework.py
	rest_framework/tests/test_authentication.py
	rest_framework/tests/test_filters.py
	rest_framework/tests/test_hyperlinkedserializers.py
	rest_framework/tests/test_serializer.py
	rest_framework/tests/test_testing.py
	rest_framework/utils/encoders.py
	tox.ini
2014-04-13 00:05:57 +02:00
Rodolfo Henrique Carvalho
c436725dd6 Fix typo in docstring for post_delete hook. 2014-01-25 23:58:42 +01:00
Tom Christie
9c41c007af Merge branch 'master' into 2.4.0
Conflicts:
	.travis.yml
	docs/api-guide/routers.md
	docs/topics/release-notes.md
	rest_framework/compat.py
2013-12-13 16:32:34 +00:00