def get_object(self, request, object_id, from_field=None):
        """
        Returns an instance matching the primary key provided. ``None``  is
        returned if no match is found (or the object_id failed validation
        against the primary key field).
        """
        queryset = self.get_queryset(request)
        model = queryset._document
        field = model._meta.pk if from_field is None else model._meta.get_field(from_field)
        try:
            object_id = field.to_python(object_id)
            return queryset.get(**{field.name: object_id})
        except (model.DoesNotExist, __HOLE__, ValueError):
            return None
dataset/ETHPy150Open jschrewe/django-mongoadmin/mongoadmin/options.py/DocumentAdmin.get_object