detail.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:foundation 作者: altio 项目源码 文件源码
def get_object(self, queryset=None):
        """
        Returns the object the view is displaying.

        By default this requires `self.queryset` and a `pk` or `slug` argument
        in the URLconf, but subclasses can override this to return any object.
        """

        obj = super(SingleObjectMixin, self).get_object(queryset=queryset)

        # TODO: Consider if we want to support normal pk/slug stuff...

        if not obj:
            raise Http404(_("No %(verbose_name)s found matching the query") %
                          {'verbose_name': self.model._meta.verbose_name})
        return obj
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号