← All notes

A Django view takes a request and returns a response

Answer: A Django view is a Python function that takes a web request and returns a web response. The response may be HTML, a redirect, a 404, XML, an image, or anything else.

Function views

The view contains logic necessary to return that response. Each view function takes an HttpRequest as its first parameter, typically named request. The name of the view function doesn’t matter.

Class-based views

django.views.generic.base.View is an intentionally simple parent class for all views. It implements dispatch-by-method and simple sanity checking. Its constructor is called from the URLconf and can take extra keyword arguments.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Django documentation and source (django/django): Copyright (c) Django Software Foundation and individual contributors; BSD-3-Clause (https://raw.githubusercontent.com/django/django/stable/6.1.x/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Django docs, Writing views, BSD-3-Clause (django/django); Django source, django.views.generic.base.View, BSD-3-Clause (django/django). Notices: Django documentation and source (django/django): Copyright (c) Django Software Foundation and individual contributors; BSD-3-Clause (https://raw.githubusercontent.com/django/django/stable/6.1.x/LICENSE).

Cite this

Permanent ID: iil:note:cadr5vd6

iinventedlight. 2026. "A Django view takes a request and returns a response." iinventedlight Library, iil:note:cadr5vd6, version of 2026-11-10. https://iinventedlight.com/library/notes/django-views/. License: CC-BY-4.0.

@misc{iil_note_cadr5vd6,
  author = {{iinventedlight}},
  title = {{A Django view takes a request and returns a response}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-10},
  url = {https://iinventedlight.com/library/notes/django-views/},
  note = {Permanent ID iil:note:cadr5vd6. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/django-views.md.