Skip to content
Back to skills

Django Apps

ASecurity

Change Django apps safely: models and migrations, querysets, views, forms, permissions and tests

  • 7 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 30, 2026
ai-agentspythonrustgosqlexpressdjangobackendsecurity

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add ansh44233/forge --skill django-apps --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Django Apps?

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

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

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
---
description: Change Django apps safely: models and migrations, querysets, views, forms, permissions and tests
profile: standard
languages: python
tags: python, django, backend
---

# Django apps

Use in projects with `manage.py` and `django` in dependencies.

## Models and migrations
- After changing a model, run `python manage.py makemigrations <app>` and read the generated file. Commit it with the model change.
- Adding a non-nullable column to a large table: add it nullable or with a default, backfill in a data migration, then make it non-null in a later migration.
- Never edit a migration that has been applied in shared environments; add a new one.
- `python manage.py makemigrations --check --dry-run` in CI catches forgotten migrations.

## Queries
- Avoid N+1: `select_related` for foreign keys, `prefetch_related` for many-to-many and reverse relations. Check with `django-debug-toolbar` or `assertNumQueries` in tests.
- Use `F()` expressions and `update()` for atomic counters; wrap multi-step writes in `transaction.atomic()`.
- Never build SQL with string formatting; use the ORM or `params` in `raw()`.

## Views and security
- Check object-level permissions: `get_object_or_404(Model, pk=pk, owner=request.user)` rather than fetching by id alone.
- Keep CSRF protection on; do not add `csrf_exempt` to session-authenticated views.
- Validate input with forms or DRF serializers; never trust `request.POST` directly.
- Settings: `DEBUG=False`, `ALLOWED_HOSTS` set, `SECRET_KEY` from the environment. `python manage.py check --deploy` lists the rest.

## Verify
`python manage.py test` (or `pytest` with pytest-django), `makemigrations --check`, and `check --deploy` for settings changes.

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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.