Commit Graph

184 Commits

Author SHA1 Message Date
Matteo Nastasi
9ec81e32da substitute '@@' code block delimiter with triple backtick, more con… (#5513)
* substitute '@@' code block delimiter with triple back-tick,  more consistent with other markdown extensions

* remove development print and allow spaces between triple backtick and syntax name in codeblock

* update comparison content for markdown test
2017-10-20 11:39:29 +02:00
Dustin Wyatt
e704dd2e40 Add import for TextLexer. (#5512)
If pygments did not recognize the language name it was being passed,
this would raise a `NameError` because `TextLexer` import was missing.
2017-10-18 20:53:05 +02:00
Mariusz Felisiak
1a526c153e Fixed Django 2.1 compatibility due to removal of django.contrib.auth.login()/logout() views. (#5510) 2017-10-18 09:46:27 +02:00
Maxim Kuznetsov
c91b081837 Support URLPattern and URLResolver from Django 2.0 (#5500)
* Support URLPattern and URLResolver from Django 2.0

* fix import order
2017-10-16 09:33:31 +02:00
Carlton Gibson
c674687782 Remove Django 1.8 & 1.9 compatibility code (#5481)
* Identify code that needs to be pulled out of/removed from compat.py

* Extract modern code from get_names_and_managers in compat.py and remove compat code

* Extract modern code from is_authenticated() in compat.py and remove.

* Extract modern code from is_anonymous() in compat.py and remove

* Extract modern code from get_related_model() from compat.py and remove

* Extract modern code from value_from_object() in compat.py and remove

* Update postgres compat

JSONField now always available.

* Remove DecimalValidator compat

* Remove get_remote_field compat

* Remove template_render compat

Plus isort.

* Remove set_many compat

* Remove include compat
2017-10-05 20:41:38 +02:00
Jascha Geerds
161dc2df2c Call Django's authenticate function with the request object (#5295)
As of Django 1.11 the `authenticate` function accepts a request as an
additional argument. This commit fixes compatibility between newer Django
versions and custom authentication backends which already depend on the request
object.

See also:

[Django 1.11 release](https://docs.djangoproject.com/en/1.11/releases/1.11/)

```
authenticate() now passes a request argument to the authenticate() method of
authentication backends. Support for methods that don’t accept request as the
first positional argument will be removed in Django 2.1.
```
2017-10-05 10:43:49 +01:00
Matteo Nastasi
063534ae50 Docstrings highlighting with pygments (#5462)
* add 'docstrings-with-pygments' feature without packages checks and tests

* move syntax_highlight doc filter in compatibility module and define it conditionally

* typo fixed

* add test for optional code highlight ('pygments' and 'markdown' packages must be installed)
2017-10-02 11:44:29 +02:00
John Eskew
607e4edca7 Defer translated string evaluation on validators. (#5452)
* Customize validators to defer error string evaluation.

* Add docstring for `CustomValidatorMessage`
2017-09-26 10:02:20 +02:00
Ryan P Kilby
f6c19e5eac Remove DjangoFilterBackend and associated tests 2017-09-20 16:47:54 +02:00
Sergey Petrunin
b0a0c30bfe Added pytz exception in compat module.
Mock pytz.timezone localize in tests.
Ref: #4986
2017-03-22 00:03:32 -04:00
Tom Christie
544b4b9948 Ensure 'markdown' dependancy is optional. Refs #4941. (#4947) 2017-03-09 16:50:00 +00:00
Tom Christie
52db57a6e7 Version 3.6 (#4943) 2017-03-09 14:49:51 +00:00
Tom Christie
68d2020112 Live API documentation (#4755) 2017-03-03 15:24:37 +00:00
Mariusz Felisiak
3001b56e06 Fixed Django 2.0 compatibility due to django.conf.urls.include parameters change. (#4866) 2017-01-30 16:11:19 +00:00
Mariusz Felisiak
1c437a793c
Removed unnecessary importlib wrapper. 2017-01-29 20:38:39 +01:00
Mariusz Felisiak
5c0f9f147c Removed unnecessary utc wrapper. (#4839) 2017-01-23 16:22:32 +00:00
Asif Saifuddin Auvi
5717e853db fix import of utc 2017-01-18 19:28:57 +06:00
Asif Saifuddin Auvi
5436df54c6 added compat shim for utc/UTC 2017-01-18 19:06:41 +06:00
Tom Christie
30bf9df5d0 Fix guardian import (#4612) 2016-10-21 16:59:43 +01:00
Lukasz Karolewski
0b346e94b1 changing order of imports (#4601)
when using with django-filter and rest_framework_swagger need to import coreapi before django-filter as django filter tries to load rest_framework.coreapi which is undefined at this point
2016-10-21 15:00:25 +01: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
Dmitry Dygalo
e1768bdc16 Fixed various typos (#4366) 2016-08-08 09:32:22 +01:00
Tom Christie
11a2468379 Access request.user.is_authenticated as property not method, under Django 1.10+ (#4358)
* For Django >=1.10 use user.is_authenticated, not user.is_authenticated()
2016-08-05 11:04:01 +01:00
Tom Christie
061e0ed084 Added url and schema_url arguments (#4321) 2016-07-28 12:08:34 +01:00
Aymeric Augustin
a436515196 Add missing return statement.
Fix #4272.
2016-07-16 22:44:49 +02:00
Tom Christie
6ff9840bde Schemas & client libraries. (#4179)
* Added schema generation support.
* New tutorial section.
* API guide on schema generation.
* Topic guide on API clients.
2016-07-04 16:38:17 +01:00
Tom Christie
9c996d7d2a Clean up existing deprecation warnings. (#4166)
* Add Meta.fields = '__all__' to serializer classes where required.
* Add explicit on_delete=models.CASCADE to ForeignKey fields.
* Use '.remote_field' and '.model' in preference to '.rel' and '.to' when inspecting model fields.
* Use new value_from_object in preference to internal _get_val_from_obj
2016-06-02 14:39:10 +01:00
Tom Christie
994e1ba927 Django 1.10 support. (#4158)
* Added TEMPLATES setting to tests
* Remove deprecated view-string in URL conf
* Replace 'urls = ...' in test classes with override_settings('ROOT_URLCONF=...')
* Refactor UsingURLPatterns to use override_settings(ROOT_URLCONF=...) style
* Get model managers and names in a version-compatible manner.
* Apply override_settings to a TestCase, not a mixin class
* Use '.callback' property instead of private attributes when inspecting urlpatterns
* Pass 'user' to template explicitly
* Correct sorting of import statements.
* Remove unused TEMPLATE_LOADERS setting, in favor of TEMPLATES.
* Remove code style issue
* BaseFilter test requires a concrete model
* Resolve tox.ini issues
* Resolve isort differences between local and tox environments
2016-06-01 15:31:00 +01:00
Karambir Singh Nain
69f1e3a9fd Remove old django checks from tests and compat
Remove skipping of tests for Django<1.8. Remove several functions from compat.py not needed for Django>=1.8
2016-02-19 01:47:45 +05:30
Simon Charette
1a052d6ee3 Silenced deprecation warnings on Django 1.8. 2016-02-04 13:49:55 -05:00
Xavier Ordoquy
8ea7d6b5c6 Merge remote-tracking branch 'origin/master' into markdown-compat
Conflicts:
	requirements/requirements-optionals.txt
2016-01-19 15:34:56 +01:00
Xavier Ordoquy
d6c326623f Make DRF compatible with multi template engine in Django 1.8 2015-11-25 07:37:01 +01:00
Andrei Fokau
2acc6a756c Use related_objects api for Django 1.9+ 2015-11-19 13:04:37 +01:00
Andrei Fokau
802ee5d0ea Fix template.render deprecation warnings for 1.9+ 2015-11-18 17:06:35 +01:00
Michael J. Schultz
abc6fa05e6 Markdown 2.1 compatible 2015-11-09 11:47:00 -06:00
Michael J. Schultz
b2e74fb523 Use markdown 2.6 extension_configs to configure extension 2015-11-05 10:52:31 -06:00
Michael J. Schultz
d9d34e4886 Use full python dot path to extension 2015-11-05 10:48:19 -06:00
Michael J. Schultz
276bc3bc2b Remove safe_mode since it is not safe. 2015-11-05 10:47:56 -06:00
José Padilla
41d1e42e9c Add compat util for DecimalValidator 2015-10-29 06:42:16 -04:00
Tom Christie
34eb18b498 Merge branch 'master' into filters
Conflicts:
	rest_framework/compat.py
	rest_framework/filters.py
2015-10-19 13:14:42 +01:00
Dulmandakh
431ac45168 Update compat.py
try to import guardian if it's in INSTALLED_APPS
2015-10-09 11:03:19 +08:00
Tom Christie
10dbf1316f Added JSONField. Closes #3170. 2015-09-28 17:25:52 +01:00
Carlton Gibson
45ace5010e Remove OrderedDict fallback 2015-09-22 16:35:38 +02:00
Carlton Gibson
0b34408172 Remove unittest.skipUnless 2015-09-22 16:24:22 +02:00
Carlton Gibson
6e86a53c92 Remove apps.get_model fallback
* Corrects presumed logic error in `ResolveModelWithPatchedDjangoTests`
2015-09-22 16:14:45 +02:00
Carlton Gibson
68c88e180f Remove ContentType import fallback 2015-09-22 15:55:39 +02:00
Carlton Gibson
8ea1606abf Remove Django 1.5 clean_manytomany_helptext fallback 2015-09-21 20:16:52 +02:00
Carlton Gibson
25de8c960f Remove Django 1.5 get_model_name fallback 2015-09-21 20:10:31 +02:00
Carlton Gibson
e625cff8a5 Remove Django 1.5 URLValidator fallback 2015-09-21 16:22:46 +02:00
Carlton Gibson
9216dc9a25 Remove Django 1.5 EmailValidator fallback 2015-09-21 16:20:07 +02:00