photologue_tags.py 文件源码

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

项目:DCRM 作者: 82Flex 项目源码 文件源码
def render(self, context):
        try:
            a = template.resolve_variable(self.photo, context)
        except:
            a = self.photo
        if isinstance(a, Photo):
            p = a
        else:
            try:
                p = Photo.objects.get(slug=a)
            except Photo.DoesNotExist:
                # Ooops. Fail silently
                return None
        if not p.is_public:
            return None
        func = getattr(p, 'get_%s_url' % (self.photosize), None)
        if func is None:
            return 'A "%s" photo size has not been defined.' % (self.photosize)
        else:
            return u'<img class="%s" src="%s" alt="%s" />' % (self.css_class, func(), p.title)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号