0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Django on_deleteの役割

Posted at

Django on_deleteの役割についてはこちらに詳しく解説されている。
典型的なon_deleteの役割を述べると

・on_delete = models.CASCADE

ForeignKeyとして登録されているモデルを消すと、
それと紐づけられているデータも全て削除される。

・on_delete = models.PROTECT

ForeignKeyとして登録されているモデルを消そうとすると、
紐づけられているデータが存在すると却下される。


ソースはこちら
https://narito.ninja/blog/detail/73/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?