django
БесплатноБез исполняемых скриптовНе проверенDjango is a batteries-included Python web framework with an ORM, admin site, authentication, forms and templates. Use when asked to start a Django project…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Django
Overview
Django is a high-level Python web framework with an ORM, migrations, admin site, forms, template engine, authentication and security middleware built in. Current release is Django 6.1 (needs Python 3.12 or newer); the 5.2 LTS series is the last that supports Python 3.10 and 3.11, and 6.2 is the next LTS. Django 6.0 added built-in Content Security Policy support and a Tasks framework (django.tasks). The code below was run on Django 6.1.2 with Django REST framework 3.18.3 and Pillow 13: manage.py check is clean and the tests pass.
Instructions
Install and start a project
$ python3 -m venv .venv && source .venv/bin/activate
$ pip install django djangorestframework pillow
$ django-admin startproject newsroom .
$ python manage.py startapp core
Pillow is only needed for ImageField. Add 'rest_framework' and 'core' to INSTALLED_APPS, and set AUTH_USER_MODEL = "core.User" before the first migration: changing it later is painful.
Models
# core/models.py
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.urls import reverse
class User(AbstractUser):
bio = models.TextField(blank=True)
avatar = models.ImageField(upload_to="avatars/", blank=True) # needs Pillow
class Article(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
body = models.TextField()
author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="articles")
published = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
ordering = ["-created_at"]
def __str__(self):
return self.title
def get_absolute_url(self):
return reverse("core:article-detail", kwargs={"slug": self.slug})
Views
The detail view filters to published articles, so drafts return 404. DetailView finds the object by the slug URL kwarg by default.
# core/views.py
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import CreateView, DetailView, ListView
from .forms import ArticleForm
from .models import Article
class ArticleListView(ListView):
queryset = Article.objects.filter(published=True).select_related("author")
template_name = "core/article_list.html"
paginate_by = 20
class ArticleDetailView(DetailView):
queryset = Article.objects.filter(published=True).select_related("author")
template_name = "core/article_detail.html" # looks up by the <slug:slug> URL kwarg
class ArticleCreateView(LoginRequiredMixin, CreateView):
model = Article
form_class = ArticleForm
template_name = "core/article_form.html"
def form_valid(self, form):
form.instance.author = self.request.user
return super().form_valid(form)
URLs
Order matters: new/ must come before <slug:slug>/, otherwise "new" is read as a slug and the create view is unreachable.
# core/urls.py
from django.urls import path
from . import views
app_name = "core"
urlpatterns = [
path("", views.ArticleListView.as_view(), name="article-list"),
path("new/", views.ArticleCreateView.as_view(), name="article-create"), # before the slug route
path("<slug:slug>/", views.ArticleDetailView.as_view(), name="article-detail"),
]
# newsroom/urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path("admin/", admin.site.urls),
path("articles/", include("core.urls")),
path("api/", include("core.api_urls")),
]
Forms and admin
ArticleForm is a ModelForm with fields = ["title", "slug", "body", "published"] (never __all__, so author stays server-controlled).
# core/admin.py
from django.contrib import admin
from .models import Article
@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
list_display = ["title", "author", "published", "created_at"]
list_filter = ["published", "created_at"]
search_fields = ["title", "body"]
prepopulated_fields = {"slug": ("title",)}
raw_id_fields = ["author"]
Templates
Add BASE_DIR / "templates" to TEMPLATES["DIRS"] and create templates/base.html with a {% block content %}. The list template (core/templates/core/article_list.html) loops {% for article in object_list %} with {% empty %}, links with {{ article.get_absolute_url }}, and shows pagination from is_paginated, page_obj.has_previous and page_obj.has_next (the ?page=N links).
REST API with Django REST framework
# core/serializers.py
from rest_framework import serializers
from .models import Article
class ArticleSerializer(serializers.ModelSerializer):
author_name = serializers.CharField(source="author.username", read_only=True)
class Meta:
model = Article
fields = ["id", "titl
Установить django в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл django?
Django is a batteries-included Python web framework with an ORM, admin site, authentication, forms and templates. Use when asked to start a Django project, write models, views, URLs or admin, add a REST API with Django REST framework, run migrations, configure settings for production, or write Django tests.
Как установить скилл django?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл django запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic