当前位置: 首页>>代码示例>>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;未经允许,请勿转载。