You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
run through: create an exam review, and then delete it through the admin site
what will happen is that django properly recognizes that it is removed from the database, but the actual file is still in MEDIA_ROOT (csc_new/media/[media] - where, in this case, [media] would be "exam_reviews" -- no quotes)
not a big deal but we don't want our webserver getting clogged with unused files without us being aware
anyone have an idea on how to fix this? I'm guessing it's just a path reference issue (e.g. the name referred to in the delete code might be wrong). Or am I missing something/doing something wrong?
The text was updated successfully, but these errors were encountered:
According to the Django documentation here, "overridden model methods are not called on bulk operations".
When the admin site does pretty much anything, it does it as a bulk operation. So our custom delete() methods are never called, which is why our custom delete behavior never actually happens.
Instead of trying to override the default behavior, we should be hooking into the models' pre_delete signal(s). This signal is always sent during deletion, bulk or not, and (even better) we know that the object still exists in the database.
More info on pre_delete (which we should use) and post_delete (which we should not use).
...
I'm having trouble figuring out how to actually implement this solution, but this is what we have to do.
run through: create an exam review, and then delete it through the admin site
what will happen is that django properly recognizes that it is removed from the database, but the actual file is still in MEDIA_ROOT (csc_new/media/[media] - where, in this case, [media] would be "exam_reviews" -- no quotes)
not a big deal but we don't want our webserver getting clogged with unused files without us being aware
anyone have an idea on how to fix this? I'm guessing it's just a path reference issue (e.g. the name referred to in the delete code might be wrong). Or am I missing something/doing something wrong?
The text was updated successfully, but these errors were encountered: