django-safedelete
django-safedelete copied to clipboard
Capability to rename 'deleted' column
I'm trying to apply django-safedelete to my django repo, but all my tables already have a deleted_at
, and I'd to avoid renaming all of these columns, since I use a naming convention where all timestamp columns are appended with _at
. Is there any way we can refactor this package to allow me to choose what column name I'd like to use?
I'm currently forking the repo to make a one line change (in models.py
), but I'd prefer not to if possible:
deleted = models.DateTimeField(name='deleted_at', editable=False, null=True)
I guess the easiest way for you to do that would be to have your own SafeDeleteModel
, and using that one:
class CustomSafeDeleteModel(SafeDeleteModel):
deleted = models.DateTimeField(name='deleted_at', editable=False, null=True)
class Meta:
abstract = True
I think you can configure that with the setting: SAFE_DELETE_FIELD_NAME
Check this! https://github.com/makinacorpus/django-safedelete/blob/master/safedelete/config.py