summaryrefslogtreecommitdiff
path: root/django/contrib/admin/models.py
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-12-12 16:55:42 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-15 22:28:37 +0100
commit6c120508b6445cb0d6198b4eacccd411960686d2 (patch)
tree95eda814c10c2d78b1f0d4dc258b55b17fecea49 /django/contrib/admin/models.py
parent817bc5800b40bcc74534de5e5176919cb826494f (diff)
Refs #34462 -- Removed ModelAdmin.log_deletion() and LogEntryManager.log_action() per deprecation timeline.
Diffstat (limited to 'django/contrib/admin/models.py')
-rw-r--r--django/contrib/admin/models.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/django/contrib/admin/models.py b/django/contrib/admin/models.py
index bb81be8297..5723ebff7f 100644
--- a/django/contrib/admin/models.py
+++ b/django/contrib/admin/models.py
@@ -1,5 +1,4 @@
import json
-import warnings
from django.conf import settings
from django.contrib.admin.utils import quote
@@ -7,7 +6,6 @@ from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.urls import NoReverseMatch, reverse
from django.utils import timezone
-from django.utils.deprecation import RemovedInDjango60Warning
from django.utils.text import get_text_list
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
@@ -26,56 +24,9 @@ ACTION_FLAG_CHOICES = [
class LogEntryManager(models.Manager):
use_in_migrations = True
- def log_action(
- self,
- user_id,
- content_type_id,
- object_id,
- object_repr,
- action_flag,
- change_message="",
- ):
- warnings.warn(
- "LogEntryManager.log_action() is deprecated. Use log_actions() instead.",
- RemovedInDjango60Warning,
- stacklevel=2,
- )
- if isinstance(change_message, list):
- change_message = json.dumps(change_message)
- return self.model.objects.create(
- user_id=user_id,
- content_type_id=content_type_id,
- object_id=str(object_id),
- object_repr=object_repr[:200],
- action_flag=action_flag,
- change_message=change_message,
- )
-
def log_actions(
self, user_id, queryset, action_flag, change_message="", *, single_object=False
):
- # RemovedInDjango60Warning.
- if type(self).log_action != LogEntryManager.log_action:
- warnings.warn(
- "The usage of log_action() is deprecated. Implement log_actions() "
- "instead.",
- RemovedInDjango60Warning,
- stacklevel=2,
- )
- return [
- self.log_action(
- user_id=user_id,
- content_type_id=ContentType.objects.get_for_model(
- obj, for_concrete_model=False
- ).id,
- object_id=obj.pk,
- object_repr=str(obj),
- action_flag=action_flag,
- change_message=change_message,
- )
- for obj in queryset
- ]
-
if isinstance(change_message, list):
change_message = json.dumps(change_message)