hi, in my django student_management_system app if i delete a Student it gets deleted,
but it's OneToOneField User (django's built in User) is not getting deleted,
it still exists in database, ie. in auth_user of db.sqlite3. how to fix this.
github code: https://github.com/anup30/student_management_system
the problem is also written in problem.txt there.
#django OneToOneField delete problem
4 messages · Page 1 of 1 (latest)
Ken has a good explanation of this at https://forum.djangoproject.com/t/does-on-delete-models-cascade-applies-bidirectionally/29901 🙂
Django Forum
Hello there, I have a question; on_delete=models.CASCADE applies bidirectionally? I defined a Profile model with field; user = models.OneToOneField(User, on_delete=models.CASCADE) Here is the full story. But experimented this. When I delete an instance from User: it is also deleted from Profile. However, when I delete an instance from P...
Basically think about the underlying rows, the cascade only kicks in when it would create a constraint violation
so i want to delete the User, as it will delete Student automatically.