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)
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
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
function hasActualValue(control: AbstractControl | null): boolean {
return !!control && control.value !== null && control.value !== '';
}
package worker
import (
"context"
"errors"
"log"
{% load cache %}
<section class="dashboard">
<h1>{{ team.name }} — Overview</h1>
{% cache 3600 team_order_stats team.id stats_version %}
<div class="stat-grid">
function createReadiness() {
let ready = true;
function markUnready() {
ready = false;
}
import { Injectable, computed, signal } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class LoadingService {
private readonly activeRequests = signal(0);
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models, transaction
from .middleware import get_current_user
package worker
import "context"
func (p *Pool) Submit(job Job) error {
// Reject fast if draining, otherwise enqueue with backpressure.
const SHUTDOWN_TIMEOUT_MS = 10_000;
function registerFatalHandlers({ logger, onFatal, exitCode = 1 }) {
let shuttingDown = false;
async function handleFatal(kind, error) {
from django.db import models
from django.utils.text import slugify
class Article(models.Model):
title = models.CharField(max_length=200)
import { Injectable, signal, computed } from '@angular/core';
export interface CurrentUser {
id: string;
email: string;
roles: string[];