Utilities & Miscellaneous
Snippets for miscellaneous Django utilities, covering email sending, management commands, scripts, and helper functions. Quick solutions for everyday Django development tasks.
Send HTML Email with Templates
Render an HTML template and send as rich email.
Custom Management Command
Create a reusable manage.py command under an app.
Cron Jobs with django-crontab
Schedule periodic jobs using django-crontab integration.
Background Tasks with Celery
Run background jobs and delayed tasks using Celery.
Context Processor for Global Template Data
Provide global variables to all templates via a custom context processor.
Messages Framework Usage
Add success/error/info messages to requests and render them in templates.
Django Humanize Filters
Enable humanize to format numbers and dates nicely.
Generate Slugs with slugify
Create URL-friendly slugs from text using slugify.
UUID Primary Keys
Use UUIDs as primary keys for models instead of integers.
CSV Export from QuerySet
Export QuerySet data as a downloadable CSV file.
CSV Import to Models
Parse CSV and create model instances programmatically.
Simple Sitemap with django.contrib.sitemaps
Create an XML sitemap for SEO using the sitemap framework.
RSS/Atom Feeds with Syndication Framework
Publish RSS/Atom feeds using DjangoÆs syndication framework.
Custom Storage Backend (Local/Cloud)
Define a custom file storage backend for local or cloud.
Cache Helper Utilities
Small helper functions for get/set/delete cache keys.
Timezone Utilities
Convert between naive and aware datetimes and set timezones.
Build Absolute URLs in Code
Generate absolute URLs in views or utilities using request.build_absolute_uri.
Simple Rate Limiter (Cache Based)
Implement a lightweight rate limiter using cache keys.