tl-its-umich-edu / canvas-app-explorer

A Web application that presents a list of Canvas external (LTI) tools with details. When integrated within Canvas, the user can search for specific LTI tool(s), and add or remove those tools from Canvas courses.
Apache License 2.0
4 stars 6 forks source link

Canvas API gettting called multiple times via `get_serializer_context` #172

Closed ssciolla closed 2 years ago

ssciolla commented 2 years ago

I noticed after #167 was merged that the Canvas API was getting called multiple times (3?) to fetch tool navigation information. This seems to be because of get_serializer_context works (I also used it twice directly).

https://github.com/tl-its-umich-edu/canvas-app-explorer/blob/f9cdee72e13ca57b159ae4f904765caa1a716714/backend/canvas_app_explorer/views.py#L17-L39

Looks like I can circumvent this issue by using a more generic view type, viewsets.ViewSet, and passing the extra data to the serializer class via a context parameter.