- 对于更复杂的视图,使用 Django 的基于类的视图(CBVs);对于较简单的逻辑,优先使用基于函数的视图(FBVs)。
- 在视图层面实现错误处理,并使用 Django 内置的错误处理机制。
- 将业务逻辑保留在模型和表单中;保持视图轻量,专注于请求处理。
Django Best Practices Django Views
Django 视图的特定指南,专注于基于类的视图与基于函数的视图、错误处理和请求处理。
Django Best Practices Django Views by liaosw97 · 829d8a8
npx skillmds@latest add liaosw97/django-best-practices-django-views File contents
---name: django-best-practices-django-viewsdescription: Django 视图的特定指南,专注于基于类的视图与基于函数的视图、错误处理和请求处理。---- 对于更复杂的视图,使用 Django 的基于类的视图(CBVs);对于较简单的逻辑,优先使用基于函数的视图(FBVs)。- 在视图层面实现错误处理,并使用 Django 内置的错误处理机制。- 将业务逻辑保留在模型和表单中;保持视图轻量,专注于请求处理。
liaosw97/awesome-rules-skills/tree/main/plugins/django/skills/django-best-practices-django-views commit 829d8a8baf
Frequently asked questions
Run npx skillmds@latest add liaosw97/django-best-practices-django-views in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Django 视图的特定指南,专注于基于类的视图与基于函数的视图、错误处理和请求处理。 It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
liaosw97 (@liaosw97) published this skill. Their other Agent Skills are listed on their SkillMD profile.