diff --git a/rest_framework_docs/api_endpoint.py b/rest_framework_docs/api_endpoint.py index 26cb0f6..d6a3a45 100644 --- a/rest_framework_docs/api_endpoint.py +++ b/rest_framework_docs/api_endpoint.py @@ -1,6 +1,7 @@ import json import inspect from django.contrib.admindocs.views import simplify_regex +from django.utils.encoding import force_str class ApiEndpoint(object): @@ -25,7 +26,7 @@ def __get_path__(self, parent_pattern): return simplify_regex(self.pattern.regex.pattern) def __get_allowed_methods__(self): - return [m.upper() for m in self.callback.cls.http_method_names if hasattr(self.callback.cls, m)] + return [force_str(m).upper() for m in self.callback.cls.http_method_names if hasattr(self.callback.cls, m)] def __get_docstring__(self): return inspect.getdoc(self.callback)