Hi there.
I’m studying the django lifecycle for save data in my history model for statistics and encounter the dispatch
view method. I know their functionality but I can’t find what class is calling it.
I would like to know what class is in charge of calling that method.
If you’re talking about the generic Class Based Views, the as_view
method in the class calls dispatch
. It’s not invoked from outside the class.
Two great resources for understanding how the generic Class Based Views function is the Classy Class Based Views site and the CBV Diagrams site.
I didn’t see this line return self.dispatch(request, *args, **kwargs)
.
Thanks a lot.
Just adding a link here in case it’s useful for anyone reading this thread, here is where dispatch(request, *args, **kwargs)
is called in the as_view
method as Ken described.