Luis Norambuena@programming.dev to Django@programming.devEnglish · 11 months agoNew goodies in Django 5.0fly.ioexternal-linkmessage-square3fedilinkarrow-up19arrow-down10file-textcross-posted to: django@programming.devdjango@programming.dev
arrow-up19arrow-down1external-linkNew goodies in Django 5.0fly.ioLuis Norambuena@programming.dev to Django@programming.devEnglish · 11 months agomessage-square3fedilinkfile-textcross-posted to: django@programming.devdjango@programming.dev
minus-square佐藤カズマ@lemmy.worldlinkfedilinkarrow-up2·11 months agoMaybe I’m dumb, but I can’t seem to grasp what Models.CASCADE does. It didn’t pop up with a definition in either the article, or the Django 4.2 docs.
minus-squareLuis Norambuena@programming.devOPlinkfedilinkEnglisharrow-up2·edit-211 months agoLook at ForeignKey -> Arguments: https://docs.djangoproject.com/en/4.2/ref/models/fields/#arguments In the sample in the linked page, deleting a Person object would also delete Order object/s linked to that particular person via the ForeignKey edit: although the syntax is usually on_delete=models.CASCADE
Maybe I’m dumb, but I can’t seem to grasp what Models.CASCADE does. It didn’t pop up with a definition in either the article, or the Django 4.2 docs.
Look at ForeignKey -> Arguments: https://docs.djangoproject.com/en/4.2/ref/models/fields/#arguments
In the sample in the linked page, deleting a
Person
object would also deleteOrder
object/s linked to that particular person via the ForeignKeyedit: although the syntax is usually
on_delete=models.CASCADE
Fucking derp. I’m dumb.