1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Refs #18974 -- Deprecated @models.permalink() decorator.

This commit is contained in:
Tim Graham
2016-10-04 14:39:49 -04:00
committed by GitHub
parent aa9569fce1
commit 0083a4c8e9
4 changed files with 55 additions and 14 deletions

View File

@@ -1,5 +1,3 @@
from functools import wraps
from django.core.exceptions import ObjectDoesNotExist # NOQA
from django.db.models import signals # NOQA
from django.db.models.aggregates import * # NOQA
@@ -37,7 +35,17 @@ def permalink(func):
(viewname, viewargs)
(viewname, viewargs, viewkwargs)
"""
import warnings
from functools import wraps
from django.urls import reverse
from django.utils.deprecation import RemovedInDjango21Warning
warnings.warn(
'permalink() is deprecated in favor of calling django.urls.reverse() '
'in the decorated method.',
RemovedInDjango21Warning
)
@wraps(func)
def inner(*args, **kwargs):