diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2025-10-18 15:03:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-18 15:03:50 +0200 |
| commit | 0c487aa3a7b2417481bf48c1e5355c855873e210 (patch) | |
| tree | 33b92a3bdf11f66d0f67fe4b4338084c7028c709 /tests/admin_utils/models.py | |
| parent | b1e0262c9f9d11eae6230b51c5aa5d71122d5f05 (diff) | |
Fixed #21961 -- Added support for database-level delete options for ForeignKey.
Thanks Simon Charette for pair programming.
Co-authored-by: Nick Stefan <NickStefan12@gmail.com>
Co-authored-by: Akash Kumar Sen <71623442+Akash-Kumar-Sen@users.noreply.github.com>
Co-authored-by: Simon Charette <charette.s@gmail.com>
Diffstat (limited to 'tests/admin_utils/models.py')
| -rw-r--r-- | tests/admin_utils/models.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/admin_utils/models.py b/tests/admin_utils/models.py index 243f314b03..e5d2b67887 100644 --- a/tests/admin_utils/models.py +++ b/tests/admin_utils/models.py @@ -40,7 +40,7 @@ class ArticleProxy(Article): proxy = True -class Count(models.Model): +class Cascade(models.Model): num = models.PositiveSmallIntegerField() parent = models.ForeignKey("self", models.CASCADE, null=True) @@ -48,6 +48,14 @@ class Count(models.Model): return str(self.num) +class DBCascade(models.Model): + num = models.PositiveSmallIntegerField() + parent = models.ForeignKey("self", models.DB_CASCADE, null=True) + + def __str__(self): + return str(self.num) + + class Event(models.Model): date = models.DateTimeField(auto_now_add=True) |
