django_skill

This skill enforces Django CBV best practices and type-safe forms, improving maintainability, security, and scalability across views, URLs, and commands.
  • Python

0

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill carlos-asg/tu-voz-en-ruta --skill django

  • SKILL.md12.0 KB

Overview

This skill captures Django modern patterns and best practices for Class-Based Views, forms with type hints, URL routing, multi-tenant handling, and management commands. It focuses on maintainability, reusability, and secure patterns for a complaint box web app serving tenant organizations. Use it when implementing or refactoring views, forms, URLs, or commands to conform with project conventions.

How this skill works

The skill enforces Class-Based Views only and recommends specific generic CBVs (TemplateView, ListView, DetailView, CreateView, UpdateView, FormView) with named override points (get_context_data, get_queryset, form_valid, get_success_url, dispatch). It shows type-hinted ModelForms with per-field and cross-field validation, tenant-aware URL configurations, and management commands that can run per-tenant using schema_context. It also demonstrates admin customization and messages-based user feedback.

When to use it

  • Creating or refactoring any view — always implement as a CBV with proper mixins
  • Building forms tied to models or standalone forms where type hints and validation matter
  • Defining URL patterns that must be namespaced and tenant-aware
  • Writing management commands that may operate across tenant schemas
  • Implementing multi-step flows like surveys with redirects and rate limiting

Best practices

  • MANDATORY: Use Class-Based Views; do not use function-based views
  • Use reverse_lazy in class attributes and get_success_url for dynamic redirects
  • Keep business logic out of views; use models/managers/services for processing
  • Validate all input in forms (clean_<field> and clean) and use type hints
  • Use get_object_or_404 for object lookup and messages framework for user feedback
  • Use LoginRequiredMixin and PermissionRequiredMixin for access control and access tenant with request.tenant

Example use cases

  • List active users with UserListView that overrides get_queryset to filter by status
  • Create and update users with ModelForm type hints and unique-email clean_email logic
  • Survey flow: selector view that auto-redirects, a form view for a unit, and a FormView to process submissions
  • Tenant-safe management command that runs logic inside django_tenants schema_context
  • Custom admin site per tenant with jazzmin settings and ModelAdmin registrations

FAQ

No. This project mandates Class-Based Views only to ensure consistency, reusability, and mixin support.

When should I use reverse_lazy vs reverse?

Use reverse_lazy in class attributes and anywhere evaluated at import time; use reverse inside methods executed at runtime.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
django skill by carlos-asg/tu-voz-en-ruta | VeilStrat