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
- id: C1 claim: A view is a Python function, also called a view function. source: S1 evidence: "A view function, or view for short, is a Python function"
- id: C2 claim: A view takes a web request and returns a web response. source: S1 evidence: "that takes a web request and returns a web response."
- id: C3 claim: The first parameter of a view is an HttpRequest. source: S1 evidence: "Each view function takes an HttpRequest object as its first parameter,"
- id: C4 claim: View is the intentionally simple parent class for all class-based views. source: S2 evidence: "Intentionally simple parent class for all views."
Sources
- [S1] Writing views. Django docs. https://docs.djangoproject.com/en/6.1/topics/http/views/ . License: BSD-3-Clause. Accessed 2026-11-10.
- [S2] django.views.generic.base.View. Django source. https://github.com/django/django/blob/stable/6.1.x/django/views/generic/base.py . License: BSD-3-Clause. Accessed 2026-11-10.
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
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.},
}
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.