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


Python Location.find_by_id方法代码示例

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


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

示例1: edit

# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
    def edit(self, id):
        c.location = Location.find_by_id(id)

        defaults = h.object_to_defaults(c.location, 'location')

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

示例2: _delete

# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
    def _delete(self, id):
        c.location = Location.find_by_id(id)
        meta.Session.delete(c.location)
        meta.Session.commit()

        h.flash("Location has been deleted.")
        redirect_to('index')
开发者ID:SharifulAlamSourav,项目名称:zookeepr,代码行数:9,代码来源:location.py

示例3: delete

# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
    def delete(self, id):
        """Delete the location

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.location = Location.find_by_id(id)
        return render('/location/confirm_delete.mako')
开发者ID:SharifulAlamSourav,项目名称:zookeepr,代码行数:11,代码来源:location.py

示例4: _edit

# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
    def _edit(self, id):
        location = Location.find_by_id(id)

        for key in self.form_result['location']:
            setattr(location, key, self.form_result['location'][key])

        # update the objects with the validated form data
        meta.Session.commit()
        h.flash("The Location has been updated successfully.")
        redirect_to(action='index', id=None)
开发者ID:SharifulAlamSourav,项目名称:zookeepr,代码行数:12,代码来源:location.py

示例5: ical

# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
    def ical(self, id):
        c.schedule_collection = Location.find_by_id(id).schedule

        ical = vobject.iCalendar()
        for schedule in c.schedule_collection:
            if not schedule.time_slot.heading:
                event = ical.add('vevent')
                event.add('uid').value = str(schedule.id) + '@' + Config.get('event_host')
                # Created
                tz = timezone(Config.get('time_zone'))
                event.add('created').value = schedule.creation_timestamp.replace(tzinfo=tz)
                # Last Modified
                event.add('dtstamp').value = schedule.last_modification_timestamp.replace(tzinfo=tz)
                event.add('last-modified').value = schedule.last_modification_timestamp.replace(tzinfo=tz)
                # Start and End Time
                event.add('dtstart').value = schedule.time_slot.start_time.replace(tzinfo=tz)
                event.add('dtend').value = schedule.time_slot.end_time.replace(tzinfo=tz)
                # Title and Author (need to add Author here)
                event.add('summary').value = schedule.event.computed_title() + '. ' + h.list_to_string(schedule.event.computed_speakers())
                # Abstract, if we have one
                event.add('description').value = schedule.event.computed_abstract()
                # Add a URL
                if schedule.event.proposal:
                    event.add('url').value = h.url_for(qualified=True, controller='schedule', action='view_talk', id=schedule.event.proposal.id)
                elif not (schedule.event.url is None or schedule.event.url == ''):
                    if schedule.event.url.startswith('https://') or schedule.event.url.startswith('http://'):
                        event.add('url').value = h.url_for(str(schedule.event.url))
                    else:
                        event.add('url').value = h.url_for(str(schedule.event.url), qualified=True)

                concurrent_schedules = schedule.event.schedule_by_time_slot(schedule.time_slot)
                for concurrent_schedule in concurrent_schedules:
                    if concurrent_schedule != schedule:
                        if concurrent_schedule in c.schedule_collection:
                            c.schedule_collection.remove(concurrent_schedule)

                locations = [concurrent_schedule.location.display_name for concurrent_schedule in concurrent_schedules]
                event.add('location').value = h.list_to_string(locations)

        response.charset = 'utf8'
        response.headers['content-type'] = 'text/calendar; charset=utf8'
        response.headers.add('content-transfer-encoding', 'binary')
        response.headers.add('Pragma', 'cache')
        response.headers.add('Cache-Control', 'max-age=3600,public')
        return ical.serialize()
开发者ID:SharifulAlamSourav,项目名称:zookeepr,代码行数:47,代码来源:location.py

示例6: view

# 需要导入模块: from zkpylons.model.location import Location [as 别名]
# 或者: from zkpylons.model.location.Location import find_by_id [as 别名]
 def view(self, id):
     c.location = Location.find_by_id(id)
     return render('/location/view.mako')
开发者ID:SharifulAlamSourav,项目名称:zookeepr,代码行数:5,代码来源:location.py


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