當前位置: 首頁>>代碼示例>>Python>>正文


Python Project.objects方法代碼示例

本文整理匯總了Python中models.Project.objects方法的典型用法代碼示例。如果您正苦於以下問題:Python Project.objects方法的具體用法?Python Project.objects怎麽用?Python Project.objects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Project的用法示例。


在下文中一共展示了Project.objects方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: tasks_list

# 需要導入模塊: from models import Project [as 別名]
# 或者: from models.Project import objects [as 別名]
def tasks_list(project_id):
    pro = Project.objects.get(pk=project_id)
    tasks = Task.objects(project=pro)
    u = User.objects.get(pk = session['user_id'])
    project_list = Project.objects(user =u)

    return render_template('tasks/list.html',project=pro,tasks=tasks,pro=project_list)
開發者ID:btomashvili,項目名稱:vsmart,代碼行數:9,代碼來源:project_view.py

示例2: get_author_projects

# 需要導入模塊: from models import Project [as 別名]
# 或者: from models.Project import objects [as 別名]
def get_author_projects(author_id):
    """Retrieves a list of projects created by the author matching the id author_id.
    Pagination parameters page and per_page can be passed in the URL. They default
    respectively to 1 and 10 if omitted.
    """
    return paginate(resource_name='projects', endpoint='get_author_projects',
                    objects=Project.objects(author_id=author_id),
                    endpoint_params={'author_id': author_id})
開發者ID:fendgroupproject,項目名稱:backend,代碼行數:10,代碼來源:main.py

示例3: delete_project

# 需要導入模塊: from models import Project [as 別名]
# 或者: from models.Project import objects [as 別名]
def delete_project(project_id):
    """Deletes the project matching the id project_id."""
    project = Project.objects(id=project_id).get()
    project.delete()

    # Removes the project from the list of the author projects.
    Author.objects(id=project.author_id).update_one(pull__projects=project.id)

    return jsonify(project.to_dict())
開發者ID:fendgroupproject,項目名稱:backend,代碼行數:11,代碼來源:main.py

示例4: update_project

# 需要導入模塊: from models import Project [as 別名]
# 或者: from models.Project import objects [as 別名]
def update_project(project_id):
    """Updates the project matching the id project_id.
    Only the parameters to update or to add should be passed in the request body.
    """
    project = Project.objects(id=project_id).get()
    patched = Project(**dict(chain(project.to_dict().items(), request.get_json().items())))
    patched.save()

    return jsonify(patched.to_dict())
開發者ID:fendgroupproject,項目名稱:backend,代碼行數:11,代碼來源:main.py

示例5: decorated

# 需要導入模塊: from models import Project [as 別名]
# 或者: from models.Project import objects [as 別名]
	def decorated(*args, **kwargs):
		if 'project_slug' in kwargs:
			slug = kwargs['project_slug']
			project = Project.objects(slug=slug).first_or_404()
		if project:
			del kwargs['project_slug']
			kwargs['project'] = project
			return f(*args, **kwargs)
		else:
			abort(404) 
開發者ID:maackle,項目名稱:communitysupportedeverything.org,代碼行數:12,代碼來源:decorators.py

示例6: system_stats

# 需要導入模塊: from models import Project [as 別名]
# 或者: from models.Project import objects [as 別名]
def system_stats():
    ''' calculates and prints info about the system
    usage:
        $ . /path/to/venv/bin/activate
        (venv)$ python
        >> import application
        >> application.controllers.system_stats()
        there are 1234 entries in the system
    '''
    # initialize the mongoengine connection
    mongo_config = app.config['MONGO_CONFIG']
    mongodb_uri = 'mongodb://'
    if mongo_config['dbuser'] and mongo_config['dbpassword']:
        mongodb_uri += '%s:%[email protected]' % (mongo_config['dbuser']
                , mongo_config['dbpassword'])
    mongodb_uri += '%s/%s' % (mongo_config['hosts'], mongo_config['db_name'])
    connect(mongo_config['db_name'], host=mongodb_uri)

    projects = Project.objects()
    total_entries = 0
    total_points = 0
    for project in projects:
        schema = project.ordered_schema
        entries = Entry.objects(project=project)

        # count the points
        for entry in entries:
            # drop non-uniques or hidden
            if not entry.unique or not entry.visible:
                continue
            
            total_entries += 1

            # count datapoints
            for header in schema:
                if header.name in entry.values:
                    if entry['values'][header.name] != None:
                        total_points += 1

    print 'there are %s entries in the system' % total_entries
    print 'there are %s datapoints in the system' % total_points
開發者ID:aquaya,項目名稱:pipeline,代碼行數:43,代碼來源:system_stats.py

示例7: project

# 需要導入模塊: from models import Project [as 別名]
# 或者: from models.Project import objects [as 別名]
def project(project_id):
    pro = Project.objects.get(pk=project_id)
    u = User.objects.get(pk = session['user_id'])
    project_list = Project.objects(user =u)
    return render_template('project.html',project=pro,pro=project_list)
開發者ID:btomashvili,項目名稱:vsmart,代碼行數:7,代碼來源:project_view.py

示例8: get

# 需要導入模塊: from models import Project [as 別名]
# 或者: from models.Project import objects [as 別名]
 def get(self, tag):
     projects = Project.objects(tags=tag)
     return render_template('projects/list.html', projects=projects)
開發者ID:Mischa-Alff,項目名稱:destrock.com,代碼行數:5,代碼來源:views.py

示例9: get_project

# 需要導入模塊: from models import Project [as 別名]
# 或者: from models.Project import objects [as 別名]
def get_project(project_id):
    """Retrieves the project matching the id project_id."""
    return jsonify(Project.objects(id=project_id).get().to_dict())
開發者ID:fendgroupproject,項目名稱:backend,代碼行數:5,代碼來源:main.py


注:本文中的models.Project.objects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。