Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
django-stratagem documentation
django-stratagem documentation

Tutorials

  • Getting Started
  • Recipe Gallery
  • Building a Complete Feature
  • Construction Management Platform

How-To Guides

  • How to Use Model Fields
  • How to Use Forms, Widgets, and the Admin
  • How to Use Template Tags and Filters
  • How to Use Conditional Availability
  • How to Use Hierarchical Registries
  • How to Use DRF Integration
  • How to Use the Plugin System
  • Testing code that uses registries
  • Using registries from async code

Understand

  • Architecture and Design
  • Extension Hooks and Customization Points

Reference

  • API Reference
  • Contributing
Back to top
View this page

Recipe Gallery¶

Each recipe is a complete, runnable example app under examples/ in the source tree. Copy an app into your project and adapt the slugs and logic. All recipes are exercised by tests/test_examples.py, so they stay in sync with the library.

Notifications: conditional channels¶

examples/notifications/ registers email, sms, and webhook channels. The webhook channel is only available when NOTIFICATIONS_WEBHOOK_ENABLED is set, demonstrating conditional availability with SettingCondition.

from examples.notifications.registry import NotificationRegistry

channel = NotificationRegistry.get(slug="email")
channel.send("Build finished")  # "email:Build finished"

Payments: a gateway stored per merchant¶

examples/payments/ stores a merchant’s chosen gateway in a RegistryClassField. Set it by slug; read it back as the implementation class (use RegistryField instead if you want an instance). Because merchant.gateway is the class, merchant.gateway() constructs an instance.

from examples.payments.models import Merchant

merchant = Merchant.objects.create(name="Acme", gateway="stripe")
merchant.gateway  # the StripeGateway class
merchant.gateway().charge(500)  # construct an instance, then "stripe:500"

Exports: a format chosen through an API¶

examples/exports/ exposes the export-format registry as a DrfRegistryField in a DRF serializer, validating the requested format.

from examples.exports.serializers import ExportRequestSerializer

serializer = ExportRequestSerializer(data={"format": "csv", "row_count": 3})
serializer.is_valid()  # True
Next
Building a Complete Feature
Previous
Getting Started
Copyright © 2026, Jack Linke
Made with Sphinx and @pradyunsg's Furo
On this page
  • Recipe Gallery
    • Notifications: conditional channels
    • Payments: a gateway stored per merchant
    • Exports: a format chosen through an API