-
Notifications
You must be signed in to change notification settings - Fork 504
Deleting correspondent cascades the delete to all assigned documents #235
Comments
I agree. Also, is there currently a way of deleting correspondents without removing the documents as well? |
That seems like reasonable behaviour. Django's default behaviour is to cascade deletes, which is why this is happening, but it can be prevented with an argument to to the field definition. If one of you wants to issue a PR with this (and a test!) then I'll merge it. Otherwise I'll try to get to this soon. |
I had a quick look at this, and applying @danielquinn's approach would be as follows and it seems to work fine on my end.
See https://docs.djangoproject.com/en/1.10/ref/models/fields/#django.db.models.ForeignKey.on_delete. I'm not sure yet about an appropriate test though. |
Thanks for your patience on this guys. I've written a fix (and a corresponding test) and it's now in |
Thanks, Daniel! |
The same issue is (still) present with tags |
That's odd, since an n:1 relationship (like documents have with tags) should never result in a cascade delete. I'll re-open this and see if I can write a test for it. |
It is phrased a bit oddly but on my setup deleting a tag just deletes the tag and its associations. From the delete-a-tag dialog:
It is deleting the respective assignment of the tags (the document-tag relationship) and the tag itself. |
That's the expected behaviour. If you delete a tag, then it, and all associations with it should go, but the documents to which it was linked should not be removed. So am I to understand that this is a non-issue? |
@ddddavidmartin is right, i misinterpreted the warning. Sorry. |
K cool. Re-closing now. |
self serve pdf.worker.min.js
Not a bug report, but I was quite surprised that when I deleted a correspondent all documents assigned to that correspondent were not available anymore. This could potentially lead to some unexpected/unintended behaviour.
I just wanted to get rid of the correspondent - I like to only have some major correspondents listed and not every document has a correspondent assigned.
What do you think?
The text was updated successfully, but these errors were encountered: