mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Added pending deprecation warning to the hooks mixins.
This commit is contained in:
parent
5fb300d880
commit
b9d7a11156
|
@ -6,11 +6,18 @@ which allows mixin classes to be composed in interesting ways.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
|
|
||||||
class CreateOrUpdateHooksMixin(object):
|
class CreateOrUpdateHooksMixin(object):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
warnings.warn('The pre_save and post_save hooks are deprecated. Use perform_create and perform_update instead.',
|
||||||
|
PendingDeprecationWarning, stacklevel=2)
|
||||||
|
super(CreateOrUpdateHooksMixin, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def pre_save(obj):
|
def pre_save(obj):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -28,6 +35,11 @@ class CreateOrUpdateHooksMixin(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class DeleteHooksMixin(object):
|
class DeleteHooksMixin(object):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
warnings.warn('The pre_delete and post_delete hooks are deprecated. Use perform_delete instead.',
|
||||||
|
PendingDeprecationWarning, stacklevel=2)
|
||||||
|
super(DeleteHooksMixin, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def pre_delete(obj):
|
def pre_delete(obj):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user