mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
Make get_extra_action less permissive
This commit is contained in:
parent
382e3322f1
commit
db724db001
|
@ -25,11 +25,12 @@ from django.utils.decorators import classonlymethod
|
|||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
from rest_framework import generics, mixins, views
|
||||
from rest_framework.decorators import MethodMapper
|
||||
from rest_framework.reverse import reverse
|
||||
|
||||
|
||||
def _is_extra_action(attr):
|
||||
return hasattr(attr, 'mapping')
|
||||
return hasattr(attr, 'mapping') and isinstance(attr.mapping, MethodMapper)
|
||||
|
||||
|
||||
class ViewSetMixin:
|
||||
|
|
|
@ -90,7 +90,6 @@ class ActionViewSetWithMapping(ActionViewSet):
|
|||
mapper = ThingWithMapping()
|
||||
|
||||
|
||||
|
||||
router = SimpleRouter()
|
||||
router.register(r'actions', ActionViewSet)
|
||||
router.register(r'actions-alt', ActionViewSet, basename='actions-alt')
|
||||
|
@ -156,6 +155,7 @@ class InitializeViewSetsTestCase(TestCase):
|
|||
self.assertNotIn(attribute, dir(bare_view))
|
||||
self.assertIn(attribute, dir(view))
|
||||
|
||||
|
||||
class GetExtraActionsTests(TestCase):
|
||||
|
||||
def test_extra_actions(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user