-
-
Notifications
You must be signed in to change notification settings - Fork 438
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Is your feature request related to a problem? Please describe.
I encountered that when declaring ForeignKeyField on_delete = CASCADE, I believe that this is dangerous and in some scenarios may lead to undesirable consequences.
def ForeignKeyField(
model_name: str,
related_name: Union[Optional[str], Literal[False]] = None,
on_delete: OnDelete = CASCADE,
db_constraint: bool = True,
null: bool = False,
**kwargs: Any,
) -> "ForeignKeyRelation[MODEL] | ForeignKeyNullableRelation[MODEL]":
Describe the solution you'd like
The best solution would be to make on_delete a mandatory parameter, I believe that actions with data should be explicit.
def ForeignKeyField(
model_name: str,
on_delete: OnDelete,
related_name: Union[Optional[str], Literal[False]] = None,
db_constraint: bool = True,
null: bool = False,
**kwargs: Any,
) -> "ForeignKeyRelation[MODEL] | ForeignKeyNullableRelation[MODEL]":
Abdeldjalil-H, goodki-d, Abeautifulsnow, 0x1618 and Hammer2900
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers