Agree with Jordan. When you talk about CASCADE Delete to SET_NULL, those will
matter when the parent table is deleted.
For Example:
User
Field
Type
UserID
INT
Username
VARCHAR
Employee
Field
Type
Relationship
… some fields
User
INT
Foreignkey(User, Userid)
In this case:
1. If you
Since you are deleting the child model object none of these matters. But if
you are deleting the parent model object on_delete matters.
On Sat, 9 Nov 2019, 6:35 pm Jordan Micle, wrote:
> when you use foreingkey you will set these options
>>
> here, change like this
> on_delete=models.SET_NULL
>
>
> when you use foreingkey you will set these options
>
here, change like this
on_delete=models.SET_NULL
user = models.ForeignKey(User, null=True, on_delete=models.SET_NULL)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from
3 matches
Mail list logo