cached_fields.py 文件源码

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

项目:django-cache-extension 作者: shanbay 项目源码 文件源码
def contribute_to_class(self, cls, name, **kwargs):
        super(models.ForeignKey, self).contribute_to_class(cls, name, **kwargs)
        if issubclass(cls, models.Model):
            setattr(cls, "cached_%s" % self.name,
                    property(curry(CachedModel._cached_FIELD, field=self,
                                   cache_exc=self.cache_exc)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号