Add a Django view with its URL route and template
Scanned 9/3/2026
Install to Claude Code
npx -y skills add black141312/ada --skill django-view --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Django View?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/black141312-django-view)More formats (shields.io, HTML) on the badges page.
---
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`).
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!