Commit Graph

23 Commits

Author SHA1 Message Date
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
Ryan P Kilby
0148a9f8da Improvements to ViewSet extra actions (#5605)
* View suffix already set by initializer

* Add 'name' and 'description' attributes to ViewSet

ViewSets may now provide their `name` and `description` attributes
directly, instead of relying on view introspection to derive them.
These attributes may also be provided with the view's initkwargs.

The ViewSet `name` and `suffix` initkwargs are mutually exclusive.

The `action` decorator now provides the `name` and `description` to
the view's initkwargs. By default, these values are derived from the
method name and its docstring. The `name` may be overridden by providing
it as an argument to the decorator.

The `get_view_name` and `get_view_description` hooks now provide the
view instance to the handler, instead of the view class. The default
implementations of these handlers now respect the `name`/`description`.

* Add 'extra actions' to ViewSet & browsable APIs

* Update simple router tests

Removed old test logic around link/action decorators from `v2.3`. Also
simplified the test by making the results explicit instead of computed.

* Add method mapping to ViewSet actions

* Document extra action method mapping
2018-07-06 10:33:10 +02:00
Ryan P Kilby
8d7ce3726d Compat cleanup (#5581)
* Reenable flake8 on compat, cleanup style/imports

* Cleanup compat urls imports

* Refactor compat url pattern/resolver imports

* Add comment re dropping pytz compat

... when dropping Django 1.10

* Strip whitespace

Grrr. GitHub web editor 😡
2017-11-10 09:41:03 +01:00
s-m-b
f1ca71ce21 Pass initkwargs stored on view to instance 2017-04-06 16:38:28 +04:00
Matthew Medal
93fe531dea Breadcrumb view name suffix fix (#4750)
* add failing testcase for breadcrumb suffixes missing when using ModelViewSets

* fix get_breadcrumbs to honor overridden get_view_name and keep viewset suffixes

* ensure suffixes are appended in breadcrumb util
2016-12-20 22:19:00 +00:00
Tom Christie
0dec36eb41 Version 3.5 (#4525)
* Start test case

* Added 'requests' test client

* Address typos

* Graceful fallback if requests is not installed.

* Add cookie support

* Tests for auth and CSRF

* Py3 compat

* py3 compat

* py3 compat

* Add get_requests_client

* Added SchemaGenerator.should_include_link

* add settings for html cutoff on related fields

* Router doesn't work if prefix is blank, though project urls.py handles prefix

* Fix Django 1.10 to-many deprecation

* Add django.core.urlresolvers compatibility

* Update django-filter & django-guardian

* Check for empty router prefix; adjust URL accordingly

It's easiest to fix this issue after we have made the regex.  To try
to fix it before would require doing something different for List vs
Detail, which means we'd have to know which type of url we're
constructing before acting accordingly.

* Fix misc django deprecations

* Use TOC extension instead of header

* Fix deprecations for py3k

* Add py3k compatibility to is_simple_callable

* Add is_simple_callable tests

* Drop python 3.2 support (EOL, Dropped by Django)

* schema_renderers= should *set* the renderers, not append to them.

* API client (#4424)

* Fix release notes

* Add note about 'User account is disabled.' vs 'Unable to log in'

* Clean up schema generation (#4527)

* Handle multiple methods on custom action (#4529)

* RequestsClient, CoreAPIClient

* exclude_from_schema

* Added 'get_schema_view()' shortcut

* Added schema descriptions

* Better descriptions for schemas

* Add type annotation to schema generation

* Coerce schema 'pk' in path to actual field name

* Deprecations move into assertion errors

* Use get_schema_view in tests

* Updte CoreJSON media type

* Handle schema structure correctly when path prefixs exist. Closes #4401

* Add PendingDeprecation to Router schema generation.

* Added SCHEMA_COERCE_PATH_PK and SCHEMA_COERCE_METHOD_NAMES

* Renamed and documented 'get_schema_fields' interface.
2016-10-10 13:03:46 +01:00
Xavier Ordoquy
cfb77ae6fa Merge pull request #3273 from olliewalsh/breadcrumbs_view_name
Do not ignore overridden View.get_view_name() in breadcrumbs
2016-03-23 01:10:13 +01:00
Stephan Groß
a101251a2a Fix blank lines around docstrings 2016-03-17 11:06:47 +00:00
Ollie Walsh
332c30afb9 Lint 2015-08-14 12:20:25 +01:00
Ollie Walsh
3d0292e1cd Do not ignore overridden View.get_view_name() in breadcrumbs 2015-08-14 12:16:57 +01:00
Tom Christie
b996266431 Merge master 2015-07-23 15:28:29 +01: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
ec8e7f27e7 Fixes for format preservation 2015-05-19 15:49:37 +01:00
Tom Christie
02b6836ee8 Fix breadcrumb view names 2013-08-29 20:51:51 +01:00
Christopher Paolini
e6662d434f Improved view/description function setting
Now supports each View having its own name and description function and
overriding the global default.
2013-08-17 17:44:51 -04:00
Tom Christie
d7c08222f1 Fix breadcrumb rendering issue 2013-05-07 14:11:48 +01:00
Tom Christie
018d8b8dce Bits of cleanup 2013-04-26 15:11:11 +01:00
Tom Christie
8fa79a7fd3 Deal with List/Instance suffixes for viewsets 2013-04-26 14:59:21 +01:00
Tom Christie
f68721ade8 Factor view names/descriptions out of View class 2013-04-04 21:42:26 +01:00
Tom Christie
b052c92ac3 Cleanup imports
Mostly adding `from __future__ import unicode_literals` everywhere.
2013-02-04 20:55:35 +00:00
Tom Christie
296b737fb6 Fix repeated breadcrumbs when optional trailing slash is used 2012-11-07 10:03:51 +00:00
Tom Christie
4b691c4027 Change package name: djangorestframework -> rest_framework 2012-09-20 13:06:27 +01:00