File tree Expand file tree Collapse file tree 4 files changed +12
-16
lines changed Expand file tree Collapse file tree 4 files changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ class ON_DELETE_DB_CHOICES(Enum):
25
25
CASCADE_DB = "CASCADE"
26
26
RESTRICT_DB = "RESTRICT"
27
27
SET_NULL_DB = "SET NULL"
28
- SET_DEFAULT_DB = "SET DEFAULT"
29
28
30
29
31
30
def CASCADE (collector , field , sub_objs , using ):
Original file line number Diff line number Diff line change @@ -1049,8 +1049,10 @@ def _check_on_delete(self):
1049
1049
return [
1050
1050
checks .Error (
1051
1051
"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" ,
1054
1056
obj = self ,
1055
1057
id = "fields.E325" ,
1056
1058
)
Original file line number Diff line number Diff line change @@ -29,15 +29,6 @@ class Baz(models.Model):
29
29
)
30
30
31
31
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
-
41
32
class RestrictBar (models .Model ):
42
33
"""First level child of foo with cascading set to restrict"""
43
34
Original file line number Diff line number Diff line change @@ -115,8 +115,10 @@ class MultipleInheritedBar(Foo, Bar):
115
115
[
116
116
Error (
117
117
"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" ,
120
122
obj = field ,
121
123
id = "fields.E325" ,
122
124
)
@@ -129,8 +131,10 @@ class MultipleInheritedBar(Foo, Bar):
129
131
[
130
132
Error (
131
133
"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" ,
134
138
obj = multiple_inheritence_field ,
135
139
id = "fields.E325" ,
136
140
)
You can’t perform that action at this time.
0 commit comments