Only support markdown 2.6+

This commit is contained in:
Tim Gates 2019-04-13 13:06:23 +10:00
parent bfa42cf0a8
commit 64b311a816
No known key found for this signature in database
GPG Key ID: AE3BE0D53823CF05
3 changed files with 5 additions and 14 deletions

View File

@ -93,7 +93,7 @@ each Python and Django series.
The following packages are optional:
* [coreapi][coreapi] (1.32.0+) - Schema generation support.
* [Markdown][markdown] (2.1.0+) - Markdown support for the browsable API.
* [Markdown][markdown] (2.6.0+) - Markdown support for the browsable API.
* [django-filter][django-filter] (1.0.1+) - Filtering support.
* [django-crispy-forms][django-crispy-forms] - Improved HTML display for filtering.
* [django-guardian][django-guardian] (1.1.1+) - Object level permissions support.

View File

@ -8,7 +8,7 @@ ______ _____ _____ _____ __
"""
__title__ = 'Django REST framework'
__version__ = '3.9.2'
__version__ = '3.9.2.2'
__author__ = 'Tom Christie'
__license__ = 'BSD 2-Clause'
__copyright__ = 'Copyright 2011-2019 Encode OSS Ltd'

View File

@ -180,19 +180,10 @@ if 'patch' not in View.http_method_names:
View.http_method_names = View.http_method_names + ['patch']
# Markdown is optional
# Markdown is optional (version 2.6+ required)
try:
import markdown
if not hasattr(markdown, '__version__') and markdown.version <= '2.2':
HEADERID_EXT_PATH = 'headerid'
LEVEL_PARAM = 'level'
elif ((not hasattr(markdown, '__version__')
) or ((not isinstance(markdown.__version__, type(''))
) and markdown.version < '2.6')):
HEADERID_EXT_PATH = 'markdown.extensions.headerid'
LEVEL_PARAM = 'level'
else:
HEADERID_EXT_PATH = 'markdown.extensions.toc'
LEVEL_PARAM = 'baselevel'