def management_project_manage(): get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE) projects = MongoProject.objects() if request.method == 'POST': # # check for selection # if 'selectedprojects' in request.form: data = dict(request.form) project_ids = data['selectedprojects'] action = str(data['button'][0]) for projectid in project_ids: project = MongoProject.objects(projectid=projectid)[0] project.status = action project.save() get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE) projects = MongoProject.objects() return render_template('management/project_manage.html', projects=projects, with_edit="True", title="Project Management", states=ProjectSTATUS)
def management_project_manage(): connect('user', port=27777) projects = MongoProject.objects() if request.method == 'POST': # # check for selection # if 'selectedprojects' in request.form: data = dict(request.form) project_ids = data['selectedprojects'] action = str(data['button'][0]) for projectid in project_ids: project = MongoProject.objects(projectid=projectid)[0] project.status = action project.save() connect('user', port=27777) projects = MongoProject.objects() return render_template('management/project_manage.html', projects=projects, with_edit="True", title="Project Management", states=ProjectSTATUS)
def random_project(): """generates a random project :rtype: dict """ data = Project(title=fake.sentence()[:-1], projectid=uuid.uuid4(), abstract=fake.paragraph(), intellectual_merit=fake.paragraph(), broader_impact=fake.paragraph(), use_of_fg=fake.paragraph(), scale_of_use=fake.paragraph(), categories=['FutureGrid'], keywords=['sqllite'], primary_discipline="other", orientation="Lot's of all make", contact=fake.name() + "\n" + fake.address(), url=fake.url(), active=False, status="pending", resources_services=['hadoop', 'openstack'], resources_software=['other'], resources_clusters=['india'], resources_provision=['paas']) return data
def management_project_list(): get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE) projects = MongoProject.objects() return render_template('management/project_list.html', projects=projects, with_edit="False", title="Project List")
def management_project_list(): connect('user', port=27777) projects = MongoProject.objects() return render_template('management/project_list.html', projects=projects, with_edit="False", title="Project List")
def project_profile(projectid): get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE) try: project = MongoProject.objects(projectid=projectid) if project.count() == 1: return render_template('management/project_profile.html', project=project[0], title="Project Management") else: raise Exception except: print "Error: Project not found" return render_template('management/error.html', error="The project does not exist")
def project_profile(projectid): connect('user', port=27777) try: project = MongoProject.objects(projectid=projectid) if project.count() == 1: return render_template('management/project_profile.html', project=project[0], title="Project Management") else: raise Exception except: print "Error: Project not found" return render_template('management/error.html', error="The project does not exist")
def main(): ''' a test function to create 10 users and 3 projects ''' generate_users(10) generate_projects(3) print(70 * "=") print(users.find()) print(70 * "=") print(70 * "&") print(users.find()[0]) projects = Project.objects() print(projects.count()) pprint(projects[0])
def main(): ''' a test function to create 10 users and 3 projects ''' # get a connection first get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE) generate_users(10) generate_projects(3) print 70 * "=" print users.find() print 70 * "=" print 70 * "&" print users.find()[0] projects = Project.objects() print projects.count() pprint(projects[0])
def random_project(): """generates a random project :rtype: dict """ data = Project(title=fake.sentence()[:-1], categories=['FutureGrid'], keywords=['sqllite'], contact=fake.name() + "\n" + fake.address(), orientation="Lot's of all make", primary_discipline="other", projectid=uuid.uuid4(), abstract=fake.paragraph(), intellectual_merit=fake.paragraph(), broader_impact=fake.paragraph(), url=fake.url(), results=fake.sentence(), grant_organization="NSF", grant_id="1001", grant_url=fake.url(), resources_services=['hadoop', 'openstack'], resources_software=['other'], resources_clusters=['india'], resources_provision=['paas'], comment=fake.sentence(), use_of_fg=fake.paragraph(), scale_of_use=fake.paragraph(), comments=fake.sentence(), loc_name=fake.country(), loc_street=fake.street_name(), loc_additional="None", loc_state=fake.state(), loc_country=fake.country(), active=False, status="pending") return data
def project_edit(projectid): connect('user', port=27777) try: project = MongoProject.objects(projectid=projectid) except: print "Error: pojectid not found" return render_template('management/error.html', error="The project does not exist") if request.method == 'GET': return render_template('management/project_edit.html', project=project[0], states=['save', 'cancel'], title="Project Management") elif request.method == 'POST': data = dict(request.form) action = str(data['button'][0]) # del data['button'] for key in data: data[key] = data[key][0] project = project[0] if action == 'save': for d in data: print d, ":", data[d] try: project.title = data["title"] project.abstract = data["abstract"] project.intellectual_merit = data["intellectual_merit"] project.broader_impact = data["broader_impact"] project.use_of_fg = data["use_of_fg"] project.scale_of_use = data["scale_of_use"] """ # # things that should not be changed # #project.active = data["active"] #project.status = data["status"] #project.projectid = data["projectid"] # # after apoproval this should not be changed either # project.agreement_use = data["agreement_use"] project.agreement_slides = data["agreement_slides"] project.agreement_support = data["agreement_support"] project.agreement_software = data["agreement_software"] project.agreement_documentation = data["agreement_documentation"] project.categories = data["categories"] project.keywords = data["keywords"] project.primary_discipline = data["primary_discipline"] project.orientation = data["orientation"] project.contact = data["contact"] project.url = data["url"] project.comment = data["comment"] project.lead = data["lead"] project.managers = data["managers"] project.members = data["members"] project.alumnis = data["alumnis"] project.grant_orgnization = data["grant_orgnization"] project.grant_id = data["grant_id"] project.grant_url = data["grant_url"] project.results = data["results"] project.comments = data["comments"] project.join_open = data["join_open"] project.join_notification = data["join_notification"] project.resources_services = data["resources_services"] project.resources_software = data["resources_software"] project.resources_clusters = data["resources_clusters"] project.resources_provision = data["resources_provision"] """ project.save() except Exception, e: print "ERROR", e return render_template('management/project_edit.html', project=project, states=['save', 'cancel'], title="Project Management")