Re: I have two models which are associated to each other through a ForeignKey how to delete the child model object without affecting parent model object

2019-11-09 Thread Parth Joshi
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

Re: I have two models which are associated to each other through a ForeignKey how to delete the child model object without affecting parent model object

2019-11-09 Thread Nijo Joseph
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 >

Re: I have two models which are associated to each other through a ForeignKey how to delete the child model object without affecting parent model object

2019-11-09 Thread Jordan Micle
> > 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