signals

python
class Product(models.Model):
    name = models.CharField(max_length=200)
    slug = models.SlugField(blank=True)
    price = models.DecimalField(max_digits=10, decimal_places=2)
    cost = models.DecimalField(max_digits=10, decimal_places=2)
    margin = models.DecimalField(max_digits=5, decimal_places=2, blank=True)

Django model signals vs overriding save

django python models
by Priya Sharma 2 tabs
python
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.core.mail import send_mail
from .models import User, Profile

Django signals for decoupled event handling

django python signals
by Priya Sharma 2 tabs
python
from django.db import models
from django.utils.text import slugify


class Article(models.Model):
    title = models.CharField(max_length=200)

Auto-Generate Unique Slugs in Django with a pre_save Signal and Model Method

django signals slugs
by codesnips 3 tabs
typescript
import { Injectable, signal, computed } from '@angular/core';

export interface CurrentUser {
  id: string;
  email: string;
  roles: string[];

Guarding a Lazy-Loaded Angular Admin Route with a Functional CanActivate Role Check

angular routing lazy-loading
by codesnips 3 tabs
python
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver

from .models import EmailOutbox

Sending Welcome Emails via a Django post_save Signal and Outbox Worker

django signals email
by codesnips 4 tabs
go
package main

import (
	"context"
	"log"
	"net/http"

Graceful HTTP Server Shutdown in Go with SIGINT and Context Cancellation

go http graceful-shutdown
by codesnips 2 tabs
rust
use tokio::sync::broadcast;

pub struct Shutdown {
    is_shutdown: bool,
    notify: broadcast::Receiver<()>,
}

Graceful Shutdown for a Tokio TCP Server on Ctrl-C with a Broadcast Signal

tokio async graceful-shutdown
by codesnips 3 tabs