mirror of
https://github.com/django/django.git
synced 2024-11-30 07:06:18 +01:00
Refs #24215 -- Removed add_lazy_relation() per deprecation timeline.
This commit is contained in:
parent
ddd3268975
commit
b2ffbb00a5
@ -1,7 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import inspect
|
||||
import warnings
|
||||
from functools import partial
|
||||
|
||||
from django import forms
|
||||
@ -15,7 +14,6 @@ from django.db.models.deletion import CASCADE, SET_DEFAULT, SET_NULL
|
||||
from django.db.models.query_utils import PathInfo
|
||||
from django.db.models.utils import make_model_tuple
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.functional import cached_property, curry
|
||||
from django.utils.lru_cache import lru_cache
|
||||
@ -84,19 +82,6 @@ def lazy_related_operation(function, model, *related_models, **kwargs):
|
||||
return apps.lazy_model_operation(partial(function, **kwargs), *model_keys)
|
||||
|
||||
|
||||
def add_lazy_relation(cls, field, relation, operation):
|
||||
warnings.warn(
|
||||
"add_lazy_relation() has been superseded by lazy_related_operation() "
|
||||
"and related methods on the Apps class.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
# Rearrange args for new Apps.lazy_model_operation
|
||||
|
||||
def function(local, related, field):
|
||||
return operation(field, related, local)
|
||||
|
||||
lazy_related_operation(function, cls, relation, field=field)
|
||||
|
||||
|
||||
class RelatedField(Field):
|
||||
"""
|
||||
Base class that all relational fields inherit from.
|
||||
|
@ -252,3 +252,5 @@ these features.
|
||||
|
||||
* The ``on_delete`` argument for ``ForeignKey`` and ``OneToOneField`` are now
|
||||
required.
|
||||
|
||||
* ``django.db.models.fields.add_lazy_relation()`` is removed.
|
||||
|
Loading…
Reference in New Issue
Block a user