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


Python Project.query方法代码示例

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


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

示例1: get_project

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import query [as 别名]
    def get_project(self, project_key):
        try:
            project_key = ndb.Key(urlsafe=project_key)
        except Exception as e:
            logging.warn(e)
            self.response.set_status(404)
            self.render_template("errors/404.html")
            return
        project = Project.query(ancestor=self.user.key).filter(Project.key == project_key).get()

        events = Event.query(ancestor=project.key).fetch()
        total_mins = 0
        billed_mins = 0
        for ev in events:
            total_mins = total_mins + ev.elapsed_time
            if ev.billed:
                billed_mins = billed_mins + ev.elapsed_time

        params = {
            'project': project,
            'events': events,
            'total_mins': total_mins,
            'billed_mins': billed_mins,
            'google_login': True if self.user.google_credentials else False
        }
        self.render_template('project-details.html', params)
开发者ID:giovamo,项目名称:Sar,代码行数:28,代码来源:projects.py

示例2: get_project_list

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import query [as 别名]
    def get_project_list(self):
        result = []
        projects = Project.query(ancestor=self.user.key).order(Project.name).fetch()
        for proj in projects:
            result.append({'key': proj.key.urlsafe(), 'name': proj.name.capitalize()})

        self.response.content_type = 'application/json'
        self.response.write(json.dumps(result))
开发者ID:giovamo,项目名称:Sar,代码行数:10,代码来源:calendar.py

示例3: get_project_list

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import query [as 别名]
    def get_project_list(user_key):
        projects = Project.query(ancestor=user_key).order(Project.name).fetch()

        proj_array = []
        for proj in projects:
            p = {}
            p['id'] = proj.key.urlsafe()
            p['name'] = proj.name
            p['hourly_cost'] = proj.hourly_cost
            proj_array.append(p)

        return proj_array
开发者ID:giovamo,项目名称:Sar,代码行数:14,代码来源:project_service.py

示例4: get_info

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import query [as 别名]
 def get_info(self, module_id):
     module_id = int(module_id)
     module = Module.get_by_id(module_id)
     votedCourses = {}
     account = get_account()
     if account:
         votedCourses = account.courses_voted
     votedCourses = dict(votedCourses)
     newJobsJSON = []
     jobs = Project.query(Project.job_type == module.name).fetch()
     for job in jobs:
         newProject = self.convert_to_project_JSON(job)
         newJobsJSON.append(newProject)
     info = {
         'name': module.name,
         'youtube': module.youtube,
         'yt_type': module.yt_type,
         'courses': module.courses,
         'category': module.category,
         'jobs': newJobsJSON,
         'votedCourses': votedCourses
     }
     return info
开发者ID:N0tinuse,项目名称:senior_project,代码行数:25,代码来源:info.py

示例5: get_project_list

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import query [as 别名]
    def get_project_list(self):
        projects = Project.query(ancestor=self.user.key).order(Project.name).fetch()

        return projects
开发者ID:giovamo,项目名称:Sar,代码行数:6,代码来源:projects.py

示例6: get

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import query [as 别名]
 def get(self):
     # Render three projects for front page.
     projects = Project.query().order(-Project.modified).fetch(limit = 4)
     self.templateVars['projects'] = projects
     return self.render("index.html")
开发者ID:dcastro9,项目名称:personal_site,代码行数:7,代码来源:index.py


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