2👍
✅
From the docs:
OneToOneField
accepts all of the extra arguments accepted byForeignKey
.
So yes, on_delete
should work as you expect.
(If you’re curious you can look at the implementation. You’ll see that OneToOneField
is a small subclass of ForeignKey
that basically just forces unique
to be True
.)
Source:stackexchange.com