當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。