dorm.contrib.gdpr¶
Helper de derecho de borrado para flujos GDPR Art. 17. Anonimización atómica por sujeto con allowlist explícita de FK cascade.
API¶
dorm.contrib.gdpr.erase_subject(model_cls: type, pk: Any, *, rules: dict[str, str | _Strategy] | None = None, cascade: list[type] | None = None, using: str = 'default') -> dict[str, int]
¶
Erase the row identified by pk and (optionally) every row in cascade that references it via a ForeignKey.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_cls
|
type
|
target model holding the subject's record. |
required |
pk
|
Any
|
primary key of the row to erase. |
required |
rules
|
dict[str, str | _Strategy] | None
|
|
None
|
cascade
|
list[type] | None
|
explicit list of related model classes whose rows pointing at the subject should also be rewritten. The walk is non-recursive — pass each level you want covered. |
None
|
using
|
str
|
database alias for both the subject and cascade writes. |
'default'
|
Returns a dict mapping each touched model's class name to the number of rows erased.