mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Refs #18974 -- Deprecated @models.permalink() decorator.
This commit is contained in:
parent
aa9569fce1
commit
0083a4c8e9
4 changed files with 55 additions and 14 deletions
|
@ -41,6 +41,8 @@ details on these changes.
|
|||
* The ``authenticate()`` method of authentication backends will require a
|
||||
``request`` argument.
|
||||
|
||||
* The ``django.db.models.permalink()`` decorator will be removed.
|
||||
|
||||
.. _deprecation-removed-in-2.0:
|
||||
|
||||
2.0
|
||||
|
|
|
@ -554,6 +554,31 @@ Miscellaneous
|
|||
Features deprecated in 1.11
|
||||
===========================
|
||||
|
||||
``models.permalink()`` decorator
|
||||
--------------------------------
|
||||
|
||||
Use :func:`django.urls.reverse` instead. For example::
|
||||
|
||||
from django.db import models
|
||||
|
||||
class MyModel(models.Model):
|
||||
...
|
||||
|
||||
@models.permalink
|
||||
def url(self):
|
||||
return ('guitarist_detail', [self.slug])
|
||||
|
||||
becomes::
|
||||
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
|
||||
class MyModel(models.Model):
|
||||
...
|
||||
|
||||
def url(self):
|
||||
return reverse('guitarist_detail', args=[self.slug])
|
||||
|
||||
Miscellaneous
|
||||
-------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue