It is currently not possible to share multiple instances of the same class within the context.
As a workaround, a new class with a list of the original instances can be used but it creates boilerplate code.
One solution could be to use id() function to separate instances instead of the instance type. But this means that get_or_create_model may return a list of instances or by convention returns the first occurrence.
But using id() opens the possibility to subscribe for updates only for one specific model (and as an extra feature to a class in general).
It is currently not possible to share multiple instances of the same class within the context.
As a workaround, a new class with a list of the original instances can be used but it creates boilerplate code.
One solution could be to use
id()function to separate instances instead of the instance type. But this means thatget_or_create_modelmay return a list of instances or by convention returns the first occurrence.But using
id()opens the possibility to subscribe for updates only for one specific model (and as an extra feature to a class in general).