django-safedelete icon indicating copy to clipboard operation
django-safedelete copied to clipboard

How does one import DELETED_VISIBLE_BY_PK?

Open HeinrichWizardKreuser opened this issue 6 years ago • 4 comments

HeinrichWizardKreuser avatar Jun 29 '19 08:06 HeinrichWizardKreuser

from safedelete.models import SOFT_DELETE, HARD_DELETE, HARD_DELETE_NOCASCADE from safedelete.managers import DELETED_VISIBLE

But what about DELETED_VISIBLE_BY_PK? doesn't seem possible for safedelete.managers

HeinrichWizardKreuser avatar Jun 29 '19 08:06 HeinrichWizardKreuser

Import from safedelete directly, see the source: https://github.com/makinacorpus/django-safedelete/blob/master/safedelete/init.py

@Gagaro, should the documentation change to reflect where to import these from, should they be imported in models.py as well, or perhaps both? What do other Django libraries do for constants? I personally put the constants directly into the models/managers. E.g.: SafeDeleteModel.HARD_DELETE.

AndreasBackx avatar Jun 29 '19 12:06 AndreasBackx

Hi. thanks for the help! sorry for asking the same question in a different issue.

HeinrichWizardKreuser avatar Jul 01 '19 06:07 HeinrichWizardKreuser

I prefer having them on the model as well.

We should update the doc to show where to import them from.

Gagaro avatar Jul 12 '19 08:07 Gagaro