当前位置: 首页>>代码示例>>Python>>正文


Python model.DbContent类代码示例

本文整理汇总了Python中zkpylons.model.DbContent的典型用法代码示例。如果您正苦于以下问题:Python DbContent类的具体用法?Python DbContent怎么用?Python DbContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DbContent类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _delete

    def _delete(self, id):
        c.db_content = DbContent.find_by_id(id)
        meta.Session.delete(c.db_content)
        meta.Session.commit()

        h.flash("Content Deleted.")
        redirect_to('index')
开发者ID:flosokaks,项目名称:zookeepr,代码行数:7,代码来源:db_content.py

示例2: list_press

    def list_press(self):
        if c.db_content_types:
            page = request.GET.get('page', 1)
            pagination = paginate.Page(DbContent.find_all_by_type("In the press"), page = page, items_per_page = 10)

            c.db_content_pages = pagination
            c.db_content_collection = pagination.items
            c.result = True
        else:
            c.result = False
        return render('/db_content/list_press.mako')
开发者ID:n6151h,项目名称:pyconau2016,代码行数:11,代码来源:db_content.py

示例3: list_news

    def list_news(self):
        if c.db_content_types:
            page = 1
            if request.GET.has_key('page'):
                page = request.GET['page']
            pagination = paginate.Page(DbContent.find_all_by_type("News"), page = page, items_per_page = 10)

            c.db_content_pages = pagination
            c.db_content_collection = pagination.items
            c.result = True
        else:
            c.result = False
        return render('/db_content/list_news.mako')
开发者ID:flosokaks,项目名称:zookeepr,代码行数:13,代码来源:db_content.py

示例4: edit

    def edit(self, id):
        c.db_content = DbContent.find_by_id(id)

        defaults = h.object_to_defaults(c.db_content, 'db_content')
        # This is horrible, don't know a better way to do it
        if c.db_content.type:
            defaults['db_content.type'] = defaults['db_content.type_id']

        defaults['db_content.publish_date'] = c.db_content.publish_timestamp.strftime('%d/%m/%y')
        defaults['db_content.publish_time'] = c.db_content.publish_timestamp.strftime('%H:%M:%S')

        form = render('/db_content/edit.mako')
        return htmlfill.render(form, defaults)
开发者ID:flosokaks,项目名称:zookeepr,代码行数:13,代码来源:db_content.py

示例5: view

    def view(self, id):
        c.db_content = DbContent.find_by_id(id)
        if c.db_content.publish_timestamp > datetime.now() and not h.auth.authorized(h.auth.has_organiser_role):
            c.db_content = None
            return NotFoundController().view()
        elif c.db_content.publish_timestamp > datetime.now():
            h.flash(("This content is marked to be published on %s and will not be visiable to public until then." % c.db_content.publish_timestamp), 'Warning')

        if c.db_content.type.name == 'Redirect':
            redirect_to(c.db_content.body.encode("latin1"), _code=301)
	c.html_headers, c.html_body, c.menu_contents = self.parse_dbpage(
            c.db_content.body)
        return render('/db_content/view.mako')
开发者ID:flosokaks,项目名称:zookeepr,代码行数:13,代码来源:db_content.py

示例6: _edit

    def _edit(self, id):
        c.db_content = DbContent.find_by_id(id)

        for key in self.form_result['db_content']:
            if ( not key in ['publish_date', 'publish_time'] ):
                setattr(c.db_content, key, self.form_result['db_content'][key])

        if self.form_result['db_content']['publish_time'] is None:
            self.form_result['db_content']['publish_time'] = datetime.time(datetime.now())

        if self.form_result['db_content']['publish_date'] is not None:
            c.db_content.publish_timestamp = \
                    datetime.combine(self.form_result['db_content']['publish_date'], \
                                    self.form_result['db_content']['publish_time'])
        else:
            c.db_content.publish_timestamp = datetime.now()


        # update the objects with the validated form data
        meta.Session.commit()
        h.flash("Page updated.")
        redirect_to(action='view', id=id)
开发者ID:flosokaks,项目名称:zookeepr,代码行数:22,代码来源:db_content.py

示例7: index

 def index(self):
     c.db_content_collection = DbContent.find_all()
     return render('/db_content/list.mako')
开发者ID:flosokaks,项目名称:zookeepr,代码行数:3,代码来源:db_content.py

示例8: delete

 def delete(self, id):
     c.db_content = DbContent.find_by_id(id)
     return render('/db_content/confirm_delete.mako')
开发者ID:flosokaks,项目名称:zookeepr,代码行数:3,代码来源:db_content.py

示例9: page

 def page(self):
     url = h.url_for().strip("/")
     c.db_content = DbContent.find_by_url(url, abort_404=False)
     if c.db_content is not None:
        return self.view(c.db_content.id)
     return NotFoundController().view()
开发者ID:flosokaks,项目名称:zookeepr,代码行数:6,代码来源:db_content.py


注:本文中的zkpylons.model.DbContent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。