• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python schedule.Schedule类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _delete

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

        h.flash("Schedule has been deleted.")
        redirect_to('index')
开发者ID:Secko,项目名称:zookeepr,代码行数:7,代码来源:schedule.py


示例2: json

    def json(self):
        schedules = Schedule.find_all()
        output = []

        for schedule in schedules:
            if not schedule.time_slot.heading:
                row = {}
                speakers = schedule.event.computed_speakers()
                speaker_emails = schedule.event.computed_speaker_emails()
                row['Id'] = schedule.id
                row['Event'] = schedule.event_id
                row['Title'] = schedule.event.computed_title()
                row['Room Name'] = schedule.location.display_name
                row['Start'] = str(schedule.time_slot.start_time)
                row['Duration'] = str(schedule.time_slot.end_time - schedule.time_slot.start_time)
                if speakers:
                    row['Presenters'] = ','.join(speakers)
                if speaker_emails:
                    row['Presenter_emails'] = ','.join(speaker_emails)
                row['Description'] = schedule.event.computed_abstract()
                if schedule.event.proposal:
                    row['URL'] = h.url_for(qualified=True, controller='schedule', action='view_talk', id=schedule.event.proposal_id)
                output.append(row)

        response.charset = 'utf8'
        response.headers['content-type'] = 'application/json; charset=utf8'
        response.headers.add('content-transfer-encoding', 'binary')
        response.headers.add('Pragma', 'cache')
        response.headers.add('Cache-Control', 'max-age=3600,public')
        return json.write(output)
开发者ID:Secko,项目名称:zookeepr,代码行数:30,代码来源:schedule.py


示例3: new

    def new(self):
        c.signed_in_person = h.signed_in_person()
        c.events = Event.find_all()
        c.schedule = Schedule.find_all()
        c.time_slot = TimeSlot.find_all()
        if not c.signed_in_person.registration:
          return render('/vote/no_rego.mako')
        c.votes = Vote.find_by_rego(c.signed_in_person.registration.id)
        defaults = {
            'vote.vote_value': 1 
        }
        args = request.GET
        eventid = args.get('eventid',0)
        revoke = args.get('revoke',0)
        c.eventid = eventid
        if int(eventid) != 0 and c.votes.count() < 4 and revoke == 0:
            c.vote = Vote()
            c.vote.rego_id = c.signed_in_person.registration.id
            c.vote.vote_value = 1
            c.vote.event_id = eventid
            meta.Session.add(c.vote)
            meta.Session.commit()
        if int(eventid) != 0 and int(revoke) != 0:
            c.vote = Vote.find_by_event_rego(eventid,c.signed_in_person.registration.id)
            meta.Session.delete(c.vote)
            meta.Session.commit()
            redirect_to('new')
  

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


示例4: delete

    def delete(self, id):
        """Delete the schedule

        GET will return a form asking for approval.

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


示例5: _edit

    def _edit(self, id):
        schedule = Schedule.find_by_id(id)

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

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


示例6: table

    def table(self, day=None):
        filter = dict(request.GET)

        if len(c.scheduled_dates) == 0:
            return render('/schedule/no_schedule_available.mako')

        c.display_date = None

        available_days = {}
        for scheduled_date in c.scheduled_dates:
            available_days[scheduled_date.strftime('%A').lower()] = scheduled_date

        if day in available_days:
            c.display_date = available_days[day]

        if c.display_date is None:
            if date.today() in c.scheduled_dates:
                c.display_date = date.today()
            else:
                c.display_date = c.scheduled_dates[0]

        c.time_slots = TimeSlot.find_by_date(c.display_date)
        c.primary_times = {}
        for time_slot in TimeSlot.find_by_date(c.display_date, primary=True):
            c.primary_times[time_slot.start_time] = time_slot

        event_type = EventType.find_by_name('presentation')
        c.locations = Location.find_scheduled_by_date_and_type(c.display_date, event_type)
        event_type = EventType.find_by_name('mini-conf')
        c.locations = c.locations + Location.find_scheduled_by_date_and_type(c.display_date, event_type)

        c.schedule_collection = Schedule.find_by_date(c.display_date)

        c.time_increment = timedelta(minutes=5)

        c.programme = OrderedDict()

        for time_slot in c.time_slots:
            time = time_slot.start_time
            while time < time_slot.end_time:
                c.programme[time] = {}
                time = time + c.time_increment

        for schedule in c.schedule_collection:
            exclusive_event = schedule.time_slot.exclusive_event()
            time = schedule.time_slot.start_time
            if exclusive_event:
                c.programme[time]['exclusive'] = exclusive_event
            else:
                c.programme[time][schedule.location] = schedule

        if filter.has_key('raw'):
            return render('/schedule/table_raw.mako')
        else:
            return render('/schedule/table.mako')
开发者ID:Secko,项目名称:zookeepr,代码行数:55,代码来源:schedule.py


示例7: edit

    def edit(self, id):
        c.time_slots = TimeSlot.find_all()
        c.locations = Location.find_all()
        c.events = Event.find_all()
        c.schedule = Schedule.find_by_id(id)


        defaults = h.object_to_defaults(c.schedule, 'schedule')
        defaults['schedule.time_slot'] = c.schedule.time_slot_id
        defaults['schedule.location'] = c.schedule.location_id
        defaults['schedule.event'] = c.schedule.event_id

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


示例8: table

    def table(self, day=None):
        # Check if we have any schedule information to display and tell people if we don't
        if len(c.scheduled_dates) == 0:
            return render('/schedule/no_schedule_available.mako')

        # Which day should we be showing now?
        c.display_date = None
        available_days = { scheduled_date.strftime('%A').lower(): scheduled_date for scheduled_date in c.scheduled_dates }
        if day in available_days:
            c.display_date = available_days[day]

        if c.display_date is None:
            if date.today() in c.scheduled_dates:
                c.display_date = date.today()
            else:
                c.display_date = c.scheduled_dates[0]

        # Work out which times we should be displaying on the left hand time scale
        c.time_slots = TimeSlot.find_by_date(c.display_date)
        c.primary_times = { time_slot.start_time: time_slot  for time_slot in TimeSlot.find_by_date(c.display_date, primary=True) }

        # Find all locations that have non-exclusive events
        start = datetime.combine(c.display_date, time.min)
        end   = datetime.combine(c.display_date, time.max)
        c.locations = Location.query().join(Schedule).join(Event).join(TimeSlot).filter(TimeSlot.start_time.between(start, end)).filter(Event.exclusive != True).all()

        # Find the list of scheduled items for the required date
        c.schedule_collection = Schedule.find_by_date(c.display_date)

        # What time period will we break the time scale on the left into
        c.time_increment = timedelta(minutes=5)

        # Build up the programme for the requested day
        c.programme = OrderedDict()
        for time_slot in c.time_slots:
            mytime = time_slot.start_time
            while mytime < time_slot.end_time:
                c.programme[mytime] = {}
                mytime = mytime + c.time_increment
        for schedule in c.schedule_collection:
            exclusive_event = schedule.time_slot.exclusive_event()
            mytime = schedule.time_slot.start_time
            if exclusive_event:
                c.programme[mytime]['exclusive'] = exclusive_event
            else:
                c.programme[mytime][schedule.location] = schedule

        if 'raw' in request.GET:
            c.raw = True
        return render('/schedule/table.mako')
开发者ID:SharifulAlamSourav,项目名称:zookeepr,代码行数:50,代码来源:schedule.py


示例9: ical

    def ical(self):
        c.schedule_collection = Schedule.find_all()

        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,代码行数:45,代码来源:schedule.py


示例10: index

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


示例11: table_view

 def table_view(self, id):
     c.schedule = Schedule.find_by_id(id)
     return render('/schedule/table_view.mako')
开发者ID:Secko,项目名称:zookeepr,代码行数:3,代码来源:schedule.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python time_slot.TimeSlot类代码示例发布时间:2022-05-26
下一篇:
Python location.Location类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap