Skip to content

Commit eedcae5

Browse files
committed
Merge pull request #1 from msaelices/master
Fix a TypeError fetching the allowed_methods when the ModelViewSet has no prefix in the callback (when is the class instance).
2 parents fa5871a + 3441d6f commit eedcae5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: rest_framework_docs/api_endpoint.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ def __get_path__(self, parent_pattern):
4747

4848
def __get_allowed_methods__(self):
4949
callback_cls = self.callback.cls
50-
return sorted([force_str(m).upper() for m in callback_cls.http_method_names if hasattr(callback_cls, m) or
51-
(issubclass(callback_cls, ModelViewSet) and m in VIEWSET_METHODS.get(self.callback.suffix))])
50+
return sorted(
51+
[force_str(m).upper() for m in callback_cls.http_method_names
52+
if hasattr(callback_cls, m) or (issubclass(callback_cls, ModelViewSet)
53+
and m in VIEWSET_METHODS.get(self.callback.suffix, ''))])
5254

5355
def __get_docstring__(self):
5456
return inspect.getdoc(self.callback)

0 commit comments

Comments
 (0)