Definition: Function Based View (FBV)
A view that is too small to be part of a Class.
When to use
The view handles a single action (one HTTP method, one response).
The logic is simple enough that a class with
get/post/putmethods would be overkill.You don’t need shared state across multiple actions.
Workflow: Writing an FBV
Define a function that takes
requestas the first parameter.Return an
HttpResponse(orrender,redirect,JsonResponse).Decorate with
@require_http_methodsif you want to restrict allowed methods.