相关疑难解决方法(0)

你怎么抓住这个例外?

这段代码在django/db/models/fields.py中创建/定义了一个异常?

class ReverseSingleRelatedObjectDescriptor(six.with_metaclass(RenameRelatedObjectDescriptorMethods)):
    # This class provides the functionality that makes the related-object
    # managers available as attributes on a model class, for fields that have
    # a single "remote" value, on the class that defines the related field.
    # In the example "choice.poll", the poll attribute is a
    # ReverseSingleRelatedObjectDescriptor instance.
    def __init__(self, field_with_rel):
        self.field = field_with_rel
        self.cache_name = self.field.get_cache_name()

    @cached_property
    def RelatedObjectDoesNotExist(self):
        # The exception can't be created at initialization time since the
        # related model might not …
Run Code Online (Sandbox Code Playgroud)

python django exception

146
推荐指数
5
解决办法
5万
查看次数

标签 统计

django ×1

exception ×1

python ×1