Wednesday, December 23, 2015

Re: Handling delete of foreignkey

The, um, link in my question answers my question.

On Wed, Dec 23, 2015 at 4:57 PM, Jonty Needham <jontyneedham@gmail.com> wrote:
So I have an object that contains a foreignkey to another object that will be deleted, that means that my object should get deleted.

Having read some of the docs on https://docs.djangoproject.com/en/1.7/ref/models/fields/#django.db.models.ForeignKey.on_delete (yes I know it's 1.7) I understand that if I added

on_delete=SET_NULL to my foreignkey, when it the foreignkeyed object was deleted my object would set my foreignkey to null. Is that correct?

Jonty

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANOQRbweV-XY%3DWFH_J-84XPxL_Os%2BY1W8uA7Kf0w3RaE_rKzGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment