python类FormMixin()的实例源码

views.py 文件源码 项目:newco-legacy 作者: blaze33 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def get_context_data(self, **kwargs):
        if hasattr(self, "next"):
            kwargs.update({"next": self.next})
        context = super(ContentUpdateView, self).get_context_data(**kwargs)
        if self.model == Item:
            album = get_album(self.object)
            images = search_images(self.object.name)
            context.update({'img_album': json.dumps(album),
                            'img_search': json.dumps(images)})
        return context


# Can't directly subclass FormMixin because of get_context_data.
# Won't be an issue in 1.5


问题


面经


文章

微信
公众号

扫码关注公众号