From playbooks-virtuoso
References 33 Django components with Python 3.10+ and Django 6.0 patterns for implementing, configuring, or troubleshooting Models, QuerySets, Views, Forms, Admin, Auth, Caching, and more.
npx claudepluginhub krzysztofsurdy/code-virtuoso --plugin playbooks-virtuosoThis skill is limited to using the following tools:
Complete reference for all 33 Django components -- patterns, APIs, configuration, and best practices for Python 3.10+ and Django 6.0.
references/admin.mdreferences/async.mdreferences/auth.mdreferences/cache.mdreferences/class-based-views.mdreferences/content-types.mdreferences/database-functions.mdreferences/deployment.mdreferences/email.mdreferences/files.mdreferences/forms.mdreferences/i18n.mdreferences/logging.mdreferences/management-commands.mdreferences/messages.mdreferences/middleware.mdreferences/migrations.mdreferences/models.mdreferences/pagination.mdreferences/querysets.mdBuilds Django web apps with guidance on models, views, templates, forms, admin, REST framework, migrations, and deployment. Use for project setup or API development.
Provides Django patterns, best practices, and guides for database models/querysets, security/auth/permissions, DRF APIs/serializers/viewsets, testing, error handling, and performance/caching. Auto-activates on manage.py, settings.py, or django package.
Develops production-grade Django web applications with models, views, ORM queries, authentication systems, and admin interfaces. Use for building web apps, managing databases via Django ORM, and implementing auth.
Share bugs, ideas, or general feedback.
Complete reference for all 33 Django components -- patterns, APIs, configuration, and best practices for Python 3.10+ and Django 6.0.
from django.db import models
class Article(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
content = models.TextField()
published = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
class Meta:
ordering = ['-created_at']
def __str__(self):
return self.title
# urls.py
from django.urls import path
from . import views
urlpatterns = [
path('articles/<int:pk>/', views.article_detail, name='article_detail'),
]
# views.py
from django.shortcuts import render, get_object_or_404
def article_detail(request, pk):
article = get_object_or_404(Article, pk=pk)
return render(request, 'articles/detail.html', {'article': article})
from django.views.generic import ListView, DetailView
class ArticleListView(ListView):
model = Article
queryset = Article.objects.filter(published=True)
paginate_by = 20
class ArticleDetailView(DetailView):
model = Article
slug_field = 'slug'
from django.db.models import Q, F, Count
# Complex filtering
articles = Article.objects.filter(
Q(title__icontains='django') | Q(content__icontains='django'),
published=True,
).exclude(
author__is_active=False
).annotate(
comment_count=Count('comments')
).order_by('-created_at')
from django import forms
class ArticleForm(forms.ModelForm):
class Meta:
model = Article
fields = ['title', 'slug', 'content', 'published']
def clean_title(self):
title = self.cleaned_data['title']
if len(title) < 5:
raise forms.ValidationError('Title must be at least 5 characters.')
return title
from django.views.decorators.cache import cache_page
@cache_page(60 * 15) # 15 minutes
def article_list(request):
articles = Article.objects.filter(published=True)
return render(request, 'articles/list.html', {'articles': articles})
from django.db.models.signals import post_save
from django.dispatch import receiver
@receiver(post_save, sender=Article)
def notify_on_publish(sender, instance, created, **kwargs):
if instance.published and created:
send_notification(instance)
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Process pending articles'
def add_arguments(self, parser):
parser.add_argument('--limit', type=int, default=100)
def handle(self, *args, **options):
count = process_articles(limit=options['limit'])
self.stdout.write(self.style.SUCCESS(f'Processed {count} articles'))
from django.test import TestCase
class ArticleTests(TestCase):
def setUp(self):
self.article = Article.objects.create(
title='Test Article',
slug='test-article',
content='Content here',
published=True,
)
def test_article_detail_view(self):
response = self.client.get(f'/articles/{self.article.pk}/')
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'Test Article')