(self, object_id)
u"""
        根据 object_id 获得唯一的 Model 实例
u"""
        根据 object_id 获得唯一的 Model 实例
u 根据 object_id 获得唯一的 Model 实例
def get_object(self, object_id):
        u"""
        根据 object_id 获得唯一的 Model 实例
        """
        queryset = self.queryset()
        model = queryset.model
        try:
            object_id = model._meta.pk.to_python(object_id)
            return queryset.get(pk=object_id)
        except (model.DoesNotExist, ValidationError):
            return None
def get_object ( self , object_id ) : queryset = self . queryset ( ) model = queryset . model try : object_id = model . _meta . pk . to_python ( object_id ) return queryset . get ( pk = object_id ) except ( model . DoesNotExist , ValidationError ) : return None