Skip to content
Back to skills

Django View

ASecurity

Add a Django view with its URL route and template

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentspythongodjango

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill django-view --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Django View?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Django View
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-django-view/badge)](https://www.skillsdirectory.com/skills/black141312-django-view)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: django-view
description: Add a Django view with its URL route and template
category: frameworks
---

# Django View

Use to add a new page or endpoint to a Django app — wiring a view, a URL pattern, and (for HTML) a template.

1. Write the view in the app's `views.py`: a function view taking `request` or a class-based view (e.g. `ListView`), returning `render(request, template, context)` or a `JsonResponse`.
2. Add a URL pattern in the app's `urls.py` with a `name=`, then `include()` that app's urls from the project `urls.py` if not already.
3. For HTML, create the template under `<app>/templates/<app>/<name>.html` and render context variables.
4. Query data via the ORM in the view; pass only what the template needs in `context`.
5. Reverse URLs with `{% url 'app:name' %}` / `reverse()` rather than hardcoding paths.
6. Run `python manage.py runserver`, hit the URL, and confirm the response and template render.

## Rules
- Namespace URLs with `app_name` in the app's `urls.py` and reference them as `'app:name'`.
- Keep business logic in models/services, not fat views; views orchestrate request → response.
- Protect mutating views with CSRF (forms) and the right method guards (`require_POST`, `LoginRequiredMixin`).
- Use `get_object_or_404` instead of bare `.get()` to avoid unhandled `DoesNotExist`.
- Don't put queries in templates; resolve them in the view and watch for N+1 (use `select_related`/`prefetch_related`).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…