@classmethod
    def get_master_instance(self, ar, model, pk):
        """Return the `master_instance` corresponding to the specified primary
        key.

        You need to override this only on slave actors whose
        :attr:`master` is something else than a database model,
        e.g. the :class:`ProblemsByChecker
        <lino.modlib.plausibility.models.ProblemsByChecker>` table.

        `ar` is the action request on this actor. `model` is the
        :attr:`master`, except if :attr:`master` is `ContentType` (in
        which case `model` is the *requested* master).

        """
        if issubclass(model, models.Model):
            try:
                return model.objects.get(pk=pk)
            except __HOLE__:
                return None
            except model.DoesNotExist:
                return None
        msg = "{0} must override get_master_instance"
        msg = msg.format(self)
        raise Exception(msg)
        # from lino.core import choicelists
        # if issubclass(master, choicelists.Choice):
        #     if master.choicelist is None:
        #         kw['master_instance'] = None
        #     else:
        #         mi = master.choicelist.get_by_values(pk)
        #         kw['master_instance'] = mi
        # else:
        #     logger.info("Invalid master %s", master)
dataset/ETHPy150Open lsaffre/lino/lino/core/actors.py/Actor.get_master_instance