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

Django

407 readers
2 users here now

Django Project

Django Community

Django Ecosystem

Jobs
Learning/Docs
Podcasts:
Related Fediverse communities
Feeds

founded 1 year ago
MODERATORS
top 3 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 10 months 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 10 months ago* (last edited 10 months 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 10 months ago

Fucking derp. I'm dumb.