1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #36661 -- Added introspection of database-level delete options.

This commit is contained in:
Mariusz Felisiak
2025-10-31 14:33:27 +01:00
committed by GitHub
parent 6019147229
commit 05ba1a9228
12 changed files with 185 additions and 31 deletions

View File

@@ -110,3 +110,18 @@ class DbCommentModel(models.Model):
class Meta:
db_table_comment = "Custom table comment"
required_db_features = {"supports_comments"}
class DbOnDeleteModel(models.Model):
fk_do_nothing = models.ForeignKey(Country, on_delete=models.DO_NOTHING)
fk_db_cascade = models.ForeignKey(City, on_delete=models.DB_CASCADE)
fk_set_null = models.ForeignKey(Reporter, on_delete=models.DB_SET_NULL, null=True)
class DbOnDeleteSetDefaultModel(models.Model):
fk_db_set_default = models.ForeignKey(
Country, on_delete=models.DB_SET_DEFAULT, db_default=models.Value(1)
)
class Meta:
required_db_features = {"supports_on_delete_db_default"}