Skip to content

Commit b38eaf4

Browse files
authored
Django 6.0: Add Model.NotUpdated & ObjectNotUpdated exceptions (#2940)
1 parent 5adea71 commit b38eaf4

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

django-stubs/core/exceptions.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class AppRegistryNotReady(Exception): ...
99
class ObjectDoesNotExist(Exception):
1010
silent_variable_failure: bool
1111

12+
class ObjectNotUpdated(Exception): ...
1213
class MultipleObjectsReturned(Exception): ...
1314
class SuspiciousOperation(Exception): ...
1415
class SuspiciousMultipartForm(SuspiciousOperation): ...

django-stubs/db/models/base.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from typing import Any, ClassVar, Final, TypeVar, overload
33

44
from django.core.checks.messages import CheckMessage
55
from django.core.exceptions import MultipleObjectsReturned as BaseMultipleObjectsReturned
6-
from django.core.exceptions import ObjectDoesNotExist, ValidationError
6+
from django.core.exceptions import ObjectDoesNotExist, ObjectNotUpdated, ValidationError
77
from django.db.models import BaseConstraint, Field, QuerySet
88
from django.db.models.manager import Manager
99
from django.db.models.options import Options
@@ -40,6 +40,7 @@ class Model(metaclass=ModelBase):
4040
# and re-add them to correct concrete subclasses of 'Model'
4141
DoesNotExist: Final[type[ObjectDoesNotExist]]
4242
MultipleObjectsReturned: Final[type[BaseMultipleObjectsReturned]]
43+
NotUpdated: Final[type[ObjectNotUpdated]]
4344
# This 'objects' attribute will be deleted, via the plugin, in favor of managing it
4445
# to only exist on subclasses it exists on during runtime.
4546
objects: ClassVar[Manager[Self]]

scripts/stubtest/allowlist_todo_django60.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ django.conf.global_settings.TASKS
66
django.conf.global_settings.URLIZE_ASSUME_HTTPS
77
django.contrib.admin.AdminSite.password_change_form
88
django.contrib.admin.ModelAdmin.log_deletion
9-
django.contrib.admin.models.LogEntry.NotUpdated
109
django.contrib.admin.models.LogEntryManager.log_action
1110
django.contrib.admin.options.BaseModelAdmin.lookup_allowed
1211
django.contrib.admin.options.ModelAdmin.log_deletion
@@ -22,26 +21,15 @@ django.contrib.auth.checks.check_user_model
2221
django.contrib.auth.forms.SetPasswordMixin.__class_getitem__
2322
django.contrib.auth.management.RenamePermission
2423
django.contrib.auth.management.rename_permissions
25-
django.contrib.auth.models.Group.NotUpdated
26-
django.contrib.auth.models.Permission.NotUpdated
27-
django.contrib.auth.models.User.NotUpdated
2824
django.contrib.auth.templatetags
2925
django.contrib.auth.templatetags.auth
3026
django.contrib.contenttypes.checks.check_generic_foreign_keys
3127
django.contrib.contenttypes.checks.check_model_name_lengths
3228
django.contrib.contenttypes.fields.GenericForeignKey.ct_field_attname
3329
django.contrib.contenttypes.fields.GenericForeignKey.get_prefetch_queryset
3430
django.contrib.contenttypes.management.get_contenttypes_and_models
35-
django.contrib.contenttypes.models.ContentType.NotUpdated
36-
django.contrib.flatpages.models.FlatPage.NotUpdated
3731
django.contrib.gis.admin.AdminSite.password_change_form
3832
django.contrib.gis.admin.ModelAdmin.log_deletion
39-
django.contrib.gis.db.backends.oracle.models.OracleGeometryColumns.NotUpdated
40-
django.contrib.gis.db.backends.oracle.models.OracleSpatialRefSys.NotUpdated
41-
django.contrib.gis.db.backends.postgis.models.PostGISGeometryColumns.NotUpdated
42-
django.contrib.gis.db.backends.postgis.models.PostGISSpatialRefSys.NotUpdated
43-
django.contrib.gis.db.backends.spatialite.models.SpatialiteGeometryColumns.NotUpdated
44-
django.contrib.gis.db.backends.spatialite.models.SpatialiteSpatialRefSys.NotUpdated
4533
django.contrib.gis.db.models.Aggregate.allow_order_by
4634
django.contrib.gis.db.models.AnyValue
4735
django.contrib.gis.db.models.BaseConstraint.__init__
@@ -100,16 +88,12 @@ django.contrib.postgres.search.psql_escape
10088
django.contrib.postgres.search.quote_lexeme
10189
django.contrib.postgres.search.spec_chars_re
10290
django.contrib.postgres.utils.CheckPostgresInstalledMixin
103-
django.contrib.redirects.models.Redirect.NotUpdated
104-
django.contrib.sessions.models.Session.NotUpdated
105-
django.contrib.sites.models.Site.NotUpdated
10691
django.contrib.staticfiles.checks.check_finders
10792
django.contrib.staticfiles.checks.check_storages
10893
django.core.checks.model_checks.check_all_models
10994
django.core.checks.model_checks.check_lazy_references
11095
django.core.checks.security.base.E026
11196
django.core.checks.security.base.check_csp_settings
112-
django.core.exceptions.ObjectNotUpdated
11397
django.core.mail.EmailMessage.__init__
11498
django.core.mail.EmailMessage.message
11599
django.core.mail.EmailMultiAlternatives.__init__
@@ -178,7 +162,6 @@ django.db.migrations.executor.MigrationExecutor.record_migration
178162
django.db.migrations.loader.MigrationLoader.all_replaced_applied
179163
django.db.migrations.loader.MigrationLoader.replace_migration
180164
django.db.migrations.operations.base.Operation.__replace__
181-
django.db.migrations.recorder.MigrationRecorder.Migration.NotUpdated
182165
django.db.migrations.serializer.DeconstructableSerializer
183166
django.db.migrations.serializer.DeconstructibleSerializer
184167
django.db.migrations.serializer.ZoneInfoSerializer

0 commit comments

Comments
 (0)