Django Pgtrigger

screenshot of Django Pgtrigger
django

Write Postgres triggers for your Django models

Overview

django-pgtrigger is a tool that helps users write Postgres triggers for Django models. Triggers can be used to solve complex problems more reliably, performantly, and succinctly than using application code. This tool offers several features that make it easier to implement triggers in Django models.

Features

  • Protect: Protecting operations on rows or columns
  • ReadOnly: Making read-only models or fields
  • SoftDelete: Soft-deleting models
  • FSM: Enforcing field transitions
  • UpdateSearchVector: Keeping a search vector updated for full-text search
  • Official interfaces: Building official interfaces for specific operations
  • Versioning models: Mirror fields, computing unique model hashes, etc.

Summary

django-pgtrigger simplifies the process of implementing Postgres triggers for Django models. By using triggers, users can efficiently solve a variety of complex problems without the need for extensive code modifications. The tool provides a set of built-in trigger classes like Protect, ReadOnly, SoftDelete, and more, making it easier to handle scenarios like data protection, read-only fields, and soft deletions. Additionally, the tool offers flexibility by allowing the use of raw SQL for more complex cases, while still providing a Django-friendly interface for trigger creation and management.

django
Django

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It follows the model-view-controller (MVC) architectural pattern, providing an extensive set of built-in tools and conventions to streamline the creation of robust and scalable web applications.