Open symroe opened 5 years ago
There are a few places we do a "safe to delete check" or a "save delete". This basically uses django.contrib.admin.utils.NestedObjects to check if a delete will cause a CASCADE delete and then optionally deletes the model.
django.contrib.admin.utils.NestedObjects
Known places we do this:
people.merging.PersonMerger.safe_delete
candidates.model.popolo_extra.model_has_related_objects
candidates.model.popolo_extra.PostExtraElection.safe_delete
All these can more or less be converted to use the same couple of functions.
also elections.models.Election.safe_delete
elections.models.Election.safe_delete
There are a few places we do a "safe to delete check" or a "save delete". This basically uses
django.contrib.admin.utils.NestedObjects
to check if a delete will cause a CASCADE delete and then optionally deletes the model.Known places we do this:
people.merging.PersonMerger.safe_delete
candidates.model.popolo_extra.model_has_related_objects
candidates.model.popolo_extra.PostExtraElection.safe_delete
All these can more or less be converted to use the same couple of functions.