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


Python Event.all方法代码示例

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


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

示例1: get

# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import all [as 别名]
 def get(self):
     events = Event.all()
     path = os.path.join(os.path.dirname(__file__), 'templates/administration/event-list.html')
     template_values = {
         'events': events      
     }
     self.response.out.write(template.render(path, template_values))
开发者ID:Project78,项目名称:Project78,代码行数:9,代码来源:main.py

示例2: lis

# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import all [as 别名]
	def lis(self, user):
		all_events = Event.all()
		result = all_events.fetch(20)
		# self.response.write(result.list_index())
		context = []
		for r in all_events:
			context.append({'name':r.name, 'venue': r.venue,'id': r.key().id()})

		self.render_api_response(context)
开发者ID:oraneedwards,项目名称:GAE-Scaffold,代码行数:11,代码来源:event.py

示例3: get

# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import all [as 别名]
 def get(self, arg):
     event = Event.get_by_id(int(arg))
     notifications = []
     events = Event.all()
     path = os.path.join(os.path.dirname(__file__), '../templates/administration/event-list.html')
     template_values = {
         'notifications': notifications, 
         'events': events, 
         'logoutlink': users.create_logout_url("/") 
     }
     if not event:
         notifications.append('Het event bestaat niet.')
         self.response.out.write(template.render(path, template_values))
         return
     
     self.createGuardianPasses(event)
     notifications.append('De sleutels zijn aangemaakt')
     self.response.out.write(template.render(path, template_values))
     return
开发者ID:Project78,项目名称:Project78,代码行数:21,代码来源:administration.py

示例4: api_list

# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import all [as 别名]
	def api_list(self, user):
		events = Event.all()
		context = []
		for event in events:
			context.append({'name':event.name, 'id': event.key().id(), 'venue': event.venue })
		self.render_api_response(context)
开发者ID:oraneedwards,项目名称:GAE-Scaffold,代码行数:8,代码来源:event.py

示例5: myevents

# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import all [as 别名]
	def myevents(self):
		my_events = Event.all().filter('profile =', self.get_current_profile())
		context = {'events': my_events}
		self.render_template('event_list.html', context)
开发者ID:oraneedwards,项目名称:GAE-Scaffold,代码行数:6,代码来源:event.py

示例6: list

# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import all [as 别名]
	def list(self):
		all_events = Event.all()
		context = {'events': all_events}
		self.render_template('event_list.html', context)
开发者ID:oraneedwards,项目名称:GAE-Scaffold,代码行数:6,代码来源:event.py

示例7: get

# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import all [as 别名]
    def get(self):

        print ""
        print "<html><body style='font-family: Helvetica; font-size: 0.9em;'>"
        print time.strftime("%H:%M:%S", time.localtime()) + ": Start<br>"

        logging.info("Fetching all info")

        #        if arg != None:
        #            event = Event.get_by_id(int(arg))
        #        else:
        event = Event.all().filter("event_name", "paasrapport").get()

        days = Day.all().filter("event", event).fetch(999)
        days.sort(key=lambda day: day.date)
        max_requests = 0
        max_timepref = 0
        max_rank = 0
        allguardians = Guardian.all().fetch(9999)
        guardians = []
        requests = []
        for guardian in allguardians:
            requests = Request.all().filter("guardian", guardian).filter("event", event).fetch(999)
            if len(requests) > 0:
                max_requests = max([max_requests, len(requests)])
                guardian.requests = requests
                guardian.day_prefs = []
                for day in days:
                    guardian.day_prefs.append(DayPreference.all().filter("guardian", guardian).filter("day", day).get())
                guardian.day_prefs.sort(key=lambda day: day.rank)
                max_rank = max([max_rank, max([day.rank for day in guardian.day_prefs])])
                guardian.time_pref = TimePreference.all().filter("guardian", guardian).filter("event", event).get()
                max_timepref = max([max_timepref, guardian.time_pref.preference])
                if len(requests) > 5:
                    guardianCopy = copy.deepcopy(guardian)
                    guardian.requests = guardian.requests[: int(len(requests) / 2)]
                    guardianCopy.requests = guardianCopy.requests[int(len(requests) / 2) :]
                    guardianCopy.day_prefs[0].rank = 999
                    guardians.append(guardianCopy)
                guardians.append(guardian)

        timepref_options = range(max_timepref + 1)
        timepref_options = [1, 2, 0]

        planning = Planning(event, days)

        logging.info("All guardians/requests collected")

        for length in range(max_requests, 0, -1):
            for timepref in timepref_options:
                for rank in range(0, max_rank + 1):
                    for day_num, day in enumerate(days):
                        for guardian in filter(
                            lambda guardian: (len(guardian.requests) == length)
                            and (guardian.time_pref.preference == timepref)
                            and (
                                filter(lambda day_pref: day_pref.day.date == day.date, guardian.day_prefs)[0].rank
                                == rank
                            ),
                            guardians,
                        ):

                            # try to place these requests
                            placed = planning.place(guardian, day_num)

                            # on succes, remove guardian from guardian
                            # on fail, the guardian will return on a less preferable round
                            if placed:
                                guardians.remove(guardian)

        logging.info("Placed")

        for dayIndex, day in enumerate(planning.days):

            start = time.clock()

            lowestValue = 0
            for i, slot in enumerate(day[0]):
                lowestValue += len(planning.conflictedTeachers(day, i))
            logging.info("conflicts: " + str(lowestValue))

            # <--- Build a list of all regions

            logging.info("Building regions")
            regions = []
            for tableIndex, table in enumerate(day):

                region = [tableIndex, 0, -1]
                previousGuardian = ""

                for slotIndex, slot in enumerate(table):

                    guardianId = planning.getGuardianIdFromRequest(slot)
                    block = table[region[1] : region[2] + 1]

                    if guardianId == "":
                        if len(block) == 0:
                            region = [tableIndex, slotIndex, slotIndex]
                        elif block.count(None) == 0:
                            if previousGuardian != "":
#.........这里部分代码省略.........
开发者ID:Project78,项目名称:Project78,代码行数:103,代码来源:plan.py


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