Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cd94443

Browse files
Cleanup and optimization 1
1 parent 1684638 commit cd94443

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

django/db/models/deletion.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class ON_DELETE_DB_CHOICES(Enum):
2525
CASCADE_DB = "CASCADE"
2626
RESTRICT_DB = "RESTRICT"
2727
SET_NULL_DB = "SET NULL"
28-
SET_DEFAULT_DB = "SET DEFAULT"
2928

3029

3130
def CASCADE(collector, field, sub_objs, using):

django/db/models/fields/related.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,8 +1049,10 @@ def _check_on_delete(self):
10491049
return [
10501050
checks.Error(
10511051
"Field specifies unsupported on_delete=DB_CASCADE, on "
1052-
"inherited model",
1053-
hint="Set a default value, or change the on_delete rule.",
1052+
"inherited model as it already contains a parent_ptr "
1053+
"with in-python cascading options, both cannot be used "
1054+
"together",
1055+
hint="Change the on_delete rule to other options",
10541056
obj=self,
10551057
id="fields.E325",
10561058
)

tests/db_cascade/models.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ class Baz(models.Model):
2929
)
3030

3131

32-
# class Fiz(models.Model):
33-
# """Third level foreignkey child for Foo
34-
# Implemented using in python cascading"""
35-
# baz = models.ForeignKey(
36-
# Baz,
37-
# on_delete=models.CASCADE
38-
# )
39-
40-
4132
class RestrictBar(models.Model):
4233
"""First level child of foo with cascading set to restrict"""
4334

tests/db_cascade_checks/tests.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ class MultipleInheritedBar(Foo, Bar):
115115
[
116116
Error(
117117
"Field specifies unsupported on_delete=DB_CASCADE, on "
118-
"inherited model",
119-
hint="Set a default value, or change the on_delete rule.",
118+
"inherited model as it already contains a parent_ptr "
119+
"with in-python cascading options, both cannot be used "
120+
"together",
121+
hint="Change the on_delete rule to other options",
120122
obj=field,
121123
id="fields.E325",
122124
)
@@ -129,8 +131,10 @@ class MultipleInheritedBar(Foo, Bar):
129131
[
130132
Error(
131133
"Field specifies unsupported on_delete=DB_CASCADE, on "
132-
"inherited model",
133-
hint="Set a default value, or change the on_delete rule.",
134+
"inherited model as it already contains a parent_ptr "
135+
"with in-python cascading options, both cannot be used "
136+
"together",
137+
hint="Change the on_delete rule to other options",
134138
obj=multiple_inheritence_field,
135139
id="fields.E325",
136140
)

0 commit comments

Comments
 (0)