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


Python Project.get_project_for_projectid方法代码示例

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


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

示例1: add_project_member

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import get_project_for_projectid [as 别名]
def add_project_member(prj_id):
    form = AddProjectMemberForm(request.form)
    if request.method == 'POST' and form.validate():
        try:
            # Add new member to project
            proj = Project.get_project_for_projectid(prj_id)
            proj.add_member(name=form.name.data, email=form.email.data, 
                role=Project.ROLE_MEMBER)
            # Create an appkey for the new member
            
            key = utils.generate_key(APPKEY_LENGTH)
            prjmemkey = ProjectMemberKey(prj_id=proj.prj_id, appkey=key, 
                member_email=form.email.data)
            prjmemkey.save()
            flash("New member has been added.")
            return redirect(url_for('.view_project', prj_id=prj_id))   
        except NotUniqueException:
            flash("The member email already exists. Can not add it.", 
                category="error")
            return render_template('add_project_member.html', form=form, 
                prj_id=prj_id)
        else:
            print 'Another exception is raised.'
    # if method is GET, show a form.        
    return render_template('add_project_member.html', form=form, prj_id=prj_id)    
开发者ID:YongHoJang,项目名称:GeoTagger-Server,代码行数:27,代码来源:views.py

示例2: view_project

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import get_project_for_projectid [as 别名]
def view_project(prj_id):
    prj = Project.get_project_for_projectid(prj_id)
    if prj is not None and (prj.owner == current_user.username):
        memkeys = ProjectMemberKey.get_memberkeys_for_project(prj_id)
        return render_template('project_details.html', prj=prj, memkeys=memkeys)
    
    return render_template('404.html')
开发者ID:YongHoJang,项目名称:GeoTagger-Server,代码行数:9,代码来源:views.py

示例3: create_project

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import get_project_for_projectid [as 别名]
def create_project():
    #with lock:
    form = CreateProjectForm(request.form)
    if request.method == 'POST' and form.validate():
        new_proj = Project(prj_name=form.name.data, prj_desc=form.desc.data,
            is_private=form.is_private.data, owner=current_user.get_id())
        print 'project.is_private:', new_proj.is_private
        prj_id = new_proj.save()
        # Add a user as an owner of a project
        proj = Project.get_project_for_projectid(prj_id)
        print 'project.is_private 2:', proj.is_private
        owner_name = current_user.firstname + ' ' + current_user.lastname
        proj.add_member(name=owner_name, email=current_user.get_id(), 
            role=Project.ROLE_OWNER)
        flash("New project has been created.", category='index_page')
        # Generate a project owner's appkey & save it to ProjectMemberKey coll.
        #keygen = KeyGenerator()
        #key = keygen.getkey(APPKEY_LENGTH)
        key = utils.generate_key()
        prjmemkey = ProjectMemberKey(prj_id=proj.prj_id, appkey=key, 
            member_email=proj.owner)
        prjmemkey.save()
        return redirect(url_for('.list_projects'))

    return render_template('create_project.html', form=form)
开发者ID:YongHoJang,项目名称:GeoTagger-Server,代码行数:27,代码来源:views.py

示例4: add_project_member

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import get_project_for_projectid [as 别名]
def add_project_member(prj_id):
    # form = AddProjectMemberForm(request.form)
    # if request.method == 'POST' and form.validate():
    debug_set = current_app.config["DEBUG"]
    if debug_set == True:
        print "\n\n\n==========> account->views.py -> add_project_member() "
    form = AddProjectMemberForm()
    if form.validate_on_submit():
        try:
            # Add new member to project
            proj = Project.get_project_for_projectid(prj_id)
            proj.add_member(name=form.name.data, email=form.email.data, role=Project.ROLE_MEMBER)
            # Create an appkey for the new member

            key = utils.generate_key(settings.APPKEY_LENGTH)
            prjmemkey = ProjectMemberKey(prj_id=proj.prj_id, appkey=key, member_email=form.email.data)
            prjmemkey.save()
            flash("New member has been added.")
            return redirect(url_for(".view_project", prj_id=prj_id))
        except NotUniqueException:
            flash("The member email already exists. Can not add it.", category="error")
            return render_template("add_project_member.html", form=form, prj_id=prj_id)
        else:
            print "Another exception is raised."
    # if method is GET, show a form.
    return render_template("add_project_member.html", form=form, prj_id=prj_id)
开发者ID:koasys,项目名称:flask_scaffold,代码行数:28,代码来源:views.py

示例5: create_project

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import get_project_for_projectid [as 别名]
def create_project():
    # with lock:
    # form = CreateProjectForm(request.form)
    # if request.method == 'POST' and form.validate_on_submit():
    debug_set = current_app.config["DEBUG"]
    if debug_set == True:
        print "\n\n\n==========> account->views.py -> create_project() "
        # print "=====> is_private() :", form.is_private.data

    form = CreateProjectForm()
    if form.validate_on_submit():
        new_proj = Project(
            prj_name=form.name.data,
            prj_desc=form.desc.data,
            is_private=form.is_private.data,
            owner=current_user.get_id(),
        )
        prj_id = new_proj.save()
        # Add a user as an owner of a project
        proj = Project.get_project_for_projectid(prj_id)
        print "project.is_private 2:", proj.is_private
        owner_name = current_user.firstname + " " + current_user.lastname
        proj.add_member(name=owner_name, email=current_user.get_id(), role=Project.ROLE_OWNER)
        flash("New project has been created.", category="index_page")
        # Generate a project owner's appkey & save it to ProjectMemberKey coll.
        # keygen = KeyGenerator()
        # key = keygen.getkey(settings.APPKEY_LENGTH)
        key = utils.generate_key()
        prjmemkey = ProjectMemberKey(prj_id=proj.prj_id, appkey=key, member_email=proj.owner)
        prjmemkey.save()
        return redirect(url_for(".list_projects"))

    return render_template("create_project.html", form=form)
开发者ID:koasys,项目名称:flask_scaffold,代码行数:35,代码来源:views.py

示例6: view_project

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import get_project_for_projectid [as 别名]
def view_project(prj_id):
    debug_set = current_app.config["DEBUG"]
    if debug_set == True:
        print "\n\n\n==========> account->views.py -> view_project() "
    prj = Project.get_project_for_projectid(prj_id)
    # Read Application Setting to check a project type
    if settings.SINGLE_PROJECT_MODE and settings.USE_SINGLE_PROJECT_FORM:
        isPublished = True
    else:
        isPublished = False

    if prj is not None and (prj.owner == current_user.username):
        memkeys = ProjectMemberKey.get_memberkeys_for_project(prj_id)
        return render_template("project_details.html", prj=prj, memkeys=memkeys, isPublished=isPublished)

    return render_template("404.html")
开发者ID:koasys,项目名称:flask_scaffold,代码行数:18,代码来源:views.py

示例7: delete_project_member

# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import get_project_for_projectid [as 别名]
def delete_project_member(prj_id, member_email):
    proj = Project.get_project_for_projectid(prj_id)
    proj.delete_member(member_email)
    return redirect(url_for('.view_project', prj_id=prj_id))    
开发者ID:YongHoJang,项目名称:GeoTagger-Server,代码行数:6,代码来源:views.py


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