Remove rest framework deprecated decorators
parent
7df6450fae
commit
e43ea107ed
|
@ -15,8 +15,6 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import warnings
|
||||
|
||||
|
||||
# Rest Framework 2.4 backport some decorators.
|
||||
|
||||
|
@ -44,37 +42,3 @@ def list_route(methods=['get'], **kwargs):
|
|||
func.kwargs = kwargs
|
||||
return func
|
||||
return decorator
|
||||
|
||||
|
||||
def link(**kwargs):
|
||||
"""
|
||||
Used to mark a method on a ViewSet that should be routed for detail GET requests.
|
||||
"""
|
||||
msg = 'link is pending deprecation. Use detail_route instead.'
|
||||
warnings.warn(msg, PendingDeprecationWarning, stacklevel=2)
|
||||
|
||||
def decorator(func):
|
||||
func.bind_to_methods = ['get']
|
||||
func.detail = True
|
||||
func.permission_classes = kwargs.get('permission_classes', [])
|
||||
func.kwargs = kwargs
|
||||
return func
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
def action(methods=['post'], **kwargs):
|
||||
"""
|
||||
Used to mark a method on a ViewSet that should be routed for detail POST requests.
|
||||
"""
|
||||
msg = 'action is pending deprecation. Use detail_route instead.'
|
||||
warnings.warn(msg, PendingDeprecationWarning, stacklevel=2)
|
||||
|
||||
def decorator(func):
|
||||
func.bind_to_methods = methods
|
||||
func.detail = True
|
||||
func.permission_classes = kwargs.get('permission_classes', [])
|
||||
func.kwargs = kwargs
|
||||
return func
|
||||
|
||||
return decorator
|
||||
|
|
Loading…
Reference in New Issue