Commit Graph

7453 Commits

Author SHA1 Message Date
Carlton Gibson
d54df8c438 Refactor schema generation to allow per-view customisation (#5354)
* Initial Refactor Step

* Add descriptor class
* call from generator
* proxy back to generator for implementation.

* Move `get_link` to descriptor

* Move `get_description` to descriptor

* Remove need for generator in get_description

* Move get_path_fields to descriptor

* Move `get_serializer_fields` to descriptor

* Move `get_pagination_fields` to descriptor

* Move `get_filter_fields` to descriptor

* Move `get_encoding` to descriptor.

* Pass just `url` from SchemaGenerator to descriptor

* Make `view` a property

Encapsulates check for a view instance.

* Adjust API Reference docs

* Add `ManualSchema` class

* Refactor to `ViewInspector` plus `AutoSchema`

The interface then is **just** `get_link()`

* Add `manual_fields` kwarg to AutoSchema

* Add schema decorator for FBVs

* Adjust comments

* Docs: Provide full params in example

Ref feedback b52e372f8f (r137254795)

* Add docstring for ViewInstpector.__get__ descriptor method.

Ref https://github.com/encode/django-rest-framework/pull/5354#discussion_r137265022

* Make `schemas` a package.

* Split generators, inspectors, views.

* Adjust imports

* Rename to EndpointEnumerator

* Adjust ManualSchema to take `fields`

… and `description`.

Allows `url` and `action` to remain dynamic

* Add package/module docstrings
2017-09-14 09:46:34 +01:00
Tom Christie
5ea810d526 Drop unnecessary TODO notes. 2017-09-14 09:44:59 +01:00
Sergei Azarkin
9aaea2586b Fix authtoken managment command (#5415)
* Fix authtoken managment command username param
2017-09-12 14:03:29 +01:00
Jozef
7037ce88e9 Fix throttling documentation about Remote-Addr (#5414)
Clarify in docs that REMOTE_ADDR is part of the WSGI environ, not an HTTP header.
2017-09-12 12:08:32 +01:00
Carlton Gibson
a560a49d56 Merge pull request #5409 from rpkilby/fieldvalues-output
Add value repr to the assertion output in FieldValues tests
2017-09-11 17:34:02 +02:00
Ryan P Kilby
ae95ed1ec2 Add repr(value) to the assert msg in FieldValues 2017-09-11 05:18:39 -04:00
Sanjuro Jogdeo
0e341c24b4 Update get_object() example in permissions.md (#5401)
* Update get_object() example in permissions.md 

I'm a bit confused about the example that's provided in the 'Object level permissions' section.  Other examples (e.g. Tutorial 3 - Class Based Views) provided a pk to get_object().  It doesn't seem like this example has any way of identifying a specific object.  

Just in case I'm correct, I've prepared this pull request. But if I'm wrong, would it be possible for you to explain the example I modified?  

Many Thanks...

* Adjust patch
2017-09-08 18:51:16 +02:00
ersel-ionova
13222e45bc Make status_code documentation more readable. (#5400)
* Make status_code documentation more readable.

* Update status-codes.md
2017-09-08 16:53:17 +01:00
Carlton Gibson
e2b5cef52c Merge pull request #5398 from dolphinigle/master
Fixed the MultipleFieldLookupMixin example to properly check for object level permission
2017-09-07 07:45:58 +02:00
Irvan
b11f37eaf3 Fixed the MultipleFieldLookupMixin example to properly check for object level permission. 2017-09-07 11:06:44 +08:00
Carlton Gibson
71ad99e0b2 Merge pull request #5388 from founders4schools/fix/named-source
Fix ModelSerializer custom named fields with source on model
2017-09-04 17:24:36 +02:00
jhg14
66b2c6149e Fix code style 2017-09-04 16:17:43 +01:00
jhg14
4345894445 Add simplest possible failing test 2017-09-04 15:44:10 +01:00
jhg14
3c1bf6bfd5 Add failing test for named attribute
Fix test crudely

Remove comment
2017-09-04 15:44:04 +01:00
Igor Tokarev
79be20a7c6 Updated supported values for the NullBooleanField (#5387)
* Updated supported values for the NullBooleanField.
* Added check for unhashable types in NullBooleanField.
2017-09-04 10:11:53 +01:00
Daniele Varrazzo
e42eb42d49 Don't make the content mandatory in the generic content form (#5372)
Sometimes, probably in the upgrade from Django 1.9 to 1.10, a post with
empty content is forbidden by javascript, with the message "Please fill
in this field". Filling the form with '{}' allows an application/json
request to be submitted.

The API call itself works perfectly well with a post with empty content:
the interface shouldn't make assumptions about it.
2017-09-04 10:04:48 +01:00
Carlton Gibson
7cd59147ea Merge pull request #5376 from rpkilby/django-perms-queryset
DjangoModelPermissions should perform auth check before accessing the view's queryset
2017-09-04 08:24:40 +02:00
Ryan P Kilby
23b2d8099b Unify QS handling for model/object permissions 2017-09-01 13:56:39 -04:00
Ryan P Kilby
af460d2b69 Add PR 5376 to release notes 2017-09-01 13:37:06 -04:00
Carlton Gibson
139c8fe3d1 Merge pull request #5380 from blueyed/fix-doc
Fix doc for ErrorDetail
2017-09-01 12:39:55 +02:00
Carlton Gibson
dedd9c3863 Merge pull request #5381 from rpkilby/fix-test-name
Fix test name
2017-09-01 12:39:31 +02:00
Ryan P Kilby
bc49746dd3 Fix test name 2017-08-31 08:26:14 -04:00
Daniel Hahler
fff3db5517 Fix doc for ErrorDetail 2017-08-31 12:19:03 +02:00
Carlton Gibson
27c382c98d Merge pull request #5351 from rpkilby/requestfactory-contenttype
Unexpected result when passing empty body to RequestFactory
2017-08-31 12:13:49 +02:00
Ryan P Kilby
0ec915e623 Force content_type inclusion in APIRequestFactory 2017-08-31 05:45:12 -04:00
Carlton Gibson
bafb3ec22a Merge pull request #5375 from rpkilby/related-source-serialization
Fix default value handling for dotted sources
2017-08-31 08:52:32 +02:00
Ryan P Kilby
07258ca032 Remove None handling from fields.get_attribute() 2017-08-30 17:42:12 -04:00
Denis Untevskiy
c8773671e7 + Rejecting anonymous in DjangoModelPermissions *before* the .get_queryset call 2017-08-30 17:10:39 -04:00
Ryan P Kilby
2ea368e80f Add failing test for #5367 2017-08-30 16:53:08 -04:00
Ryan P Kilby
79c1f2154a Fix authorization few perms tests 2017-08-30 16:52:38 -04:00
Ryan P Kilby
94e5d05caa Add failing test for #5371 2017-08-30 14:06:43 -04:00
Carlton Gibson
7e3ba8b3ed Merge pull request #5373 from kiss90benedek/patch-1
Fix pyc/pycache excludes from manifest
2017-08-30 07:25:31 +02:00
Benedek Kiss
ff2fa7a866 Fix excludes
I definitely see files from `__pycache__` as well as `.pyc` files in the package. Fixed according to https://www.reddit.com/r/Python/comments/40s8qw/simplify_your_manifestin_commands and https://github.com/django/django/pull/5817
2017-08-29 22:22:00 +02:00
Carlton Gibson
1c5710bf6c Merge pull request #5369 from beda-software/master
Update link to drf-writable-nested repository in third-party serializers
2017-08-29 07:22:21 +02:00
Vadim Laletin
c0475d059d Update link to drf-writable-nested repository in third-party serializers 2017-08-29 10:39:52 +07:00
Xavier Ordoquy
1c4d277f53 Merge pull request #5362 from ashishnitinpatil/master
~api-clients documentation: installation code fix
2017-08-24 13:16:14 +02:00
Ashish Patil
26d4977cd0 ~api-clients documentation: installation code fix 2017-08-24 15:06:48 +04:00
Carlton Gibson
36cc8df85a Merge pull request #5361 from ScottKelly/response-data-doc-fix
Fix doc Response data attribute description
2017-08-24 09:45:35 +02:00
Scott Kelly
807b9c716c Fix doc Response data attribute description 2017-08-23 21:30:56 -05:00
Carlton Gibson
08ec276850 Merge pull request #5348 from fbidu/4585
Adding a more explicit error message when a view does have a get_queryset method but it returned nothing
2017-08-22 21:09:11 +02:00
Carlton Gibson
698d8b7507 Merge pull request #5350 from qwhex/patch-1
Update 2-requests-and-responses.md: consistency
2017-08-22 21:07:58 +02:00
Ryan P Kilby
eb88687e28 Test RequestFactory with empty body 2017-08-22 15:02:18 -04:00
Carlton Gibson
6a3b8cfa4c Adjust wording 2017-08-22 20:44:19 +02:00
qwhex
9b829bec2d Update 2-requests-and-responses.md: consistency
Made it consistent with Part I. Catched it when commiting the code into my local tutorial repo.
2017-08-22 20:37:31 +02:00
Felipe Bidu
6f2c3bcb12 Further clarifying the message when get_queryset returns None to include the class name that was called 2017-08-22 12:13:22 -03:00
Felipe Bidu
5fd01d06ab Adding a more explicit error message when a view does have a get_queryset method but it returned nothing 2017-08-22 11:00:19 -03:00
Carlton Gibson
fed85bc29d Merge pull request #5344 from carltongibson/3.6.4-release
Release notes etc for 3.6.4
2017-08-22 08:55:38 +02:00
Carlton Gibson
0a0bb6a871 Update release notes
For the last minute #5346
2017-08-21 20:33:51 +02:00
Carlton Gibson
0a8fa5219a Merge pull request #5346 from blueyed/docs-link-fix-undefined-schema
docs/link.html: fix/remove undefined template var "schema"
2017-08-21 20:29:01 +02:00
Daniel Hahler
e389336ad7 docs/link.html: fix/remove undefined template var "schema" 2017-08-21 14:47:43 +02:00