this post was submitted on 02 Nov 2023
10 points (100.0% liked)

Django

417 readers
3 users here now

Django Project

Django Community

Django Ecosystem

Jobs
Learning/Docs
Podcasts:
Related Fediverse communities
Feeds

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 year ago (1 children)

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.

[–] norambna 2 points 1 year ago* (last edited 1 year ago) (1 children)

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 delete Order object/s linked to that particular person via the ForeignKey

edit: although the syntax is usually on_delete=models.CASCADE

[–] [email protected] 1 points 1 year ago

Fucking derp. I'm dumb.