@property def thumb_url(self): return self.picture_url('sqr120') def url(self): return url_for('gallery.show', mod=self.cat_name, ident=self.slug); def pics_info(self): pics = [dict(title=x.title, desc=x.desc, large_url=x.url('large'), thumb_url=x.thumb_url) for x in self.attachment_pics()] return pics class Magazine(Photos): cat_id = C_MAGAZINE cat_name = 'magazine' _DEFAULT_PIC = lazy_static_url('img/blank.gif') @property def thumb_url(self): return self.picture_url('cover') def url(self): return '%smagazine/#%s' % (current_app.config['SITE_ROOT'], self.id) add_cat(C_PHOTOS, Photos) add_cat(C_MAGAZINE, Magazine)
# coding: utf-8 from david.core.article import Article, add_cat from david.core.article import Article, add_cat from david.lib.mixins.props import PropsItem from david.lib.mixins.wrapper import WrapperMixin C_NEWS = 101 C_CHARITY = 102 class News(Article): cat_id = C_NEWS cat_name = 'news' class Charity(Article): cat_id = C_CHARITY cat_name = 'charity' add_cat(C_NEWS , News) add_cat(C_CHARITY , Charity)