anfema_django_utils.db.triggers.DenyFieldUpdateTrigger
- class DenyFieldUpdateTrigger(field, name, violation_error_message=None, trigger_error_message=None)
Bases:
django.db.models.BaseConstraint
Creates a database trigger to deny any updates to the specified field.
Add it like any other Constraint to Meta.constraints.
Implemented as constraint to get automatic support for (vendor specific) sql in migrations and automatic model validation.
Supports the postgresql and mysql backends.
Methods
constraint_sql
(model, schema_editor)create_sql
(model, schema_editor)- rtype:
remove_sql
(model, schema_editor)- rtype:
validate
(model, instance[, exclude, using])- rtype:
Attributes
- constraint_sql(model, schema_editor)
- deconstruct()
- default_trigger_error_message