2👍
As their respective names imply, the get_object
method returns a single object to be manipulated by the view, while get_context_data
returns a dict to be displayed in the template. So no, you cannot replace one with the other, and your original code is perfectly fine.
Source:stackexchange.com