diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 9422e6ad5..3e1706b6a 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -184,10 +184,12 @@ if 'patch' not in View.http_method_names: try: import markdown - if markdown.version <= '2.2': + if not hasattr(markdown, '__version__') and markdown.version <= '2.2': HEADERID_EXT_PATH = 'headerid' LEVEL_PARAM = 'level' - elif markdown.version < '2.6': + elif not hasattr(markdown, '__version__') or ( + type(markdown.__version__) != type('') and markdown.version < '2.6' + ): HEADERID_EXT_PATH = 'markdown.extensions.headerid' LEVEL_PARAM = 'level' else: