mirror of
https://github.com/django/django.git
synced 2025-10-27 07:36:08 +00:00
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>
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user