コード例 #1
0
def disp_project(pname):
    #get project by project name
    data = list(Database.getProject(pname))
    updates = []
    tenders = []
    type = 'n'
    try:
        if (current_user.access == "admin"):
            if (data[-1] == 'a'):  #if allocated send updates and specify type
                updates = Database.getUpdate(pname)
                type = 'aa'
            else:  #else send tenders and specify type
                type = 'aw'
                #tenders = Database.
                tenders = (list(Database.getTender(pname)))
                for i in range(len(tenders)):
                    tenders[i] = list(tenders[i])
                tenders = tenders
                print(tenders)
        else:
            if (data[-1] == 'a'
                    and Database.pAllocTo(current_user.username, data[1])):
                #contractor can make updates
                type = 'ca'
            else:
                #contractor can make bid if date is open
                type = 'cw'
            #dont send data but send 'contractor' as type
    except:
        pass
    print(type)
    return render_template('proj_info.html', project = data, type= type,\
                   updates=updates, tenders=tenders)
コード例 #2
0
ファイル: views.py プロジェクト: shashi1996/GTMS
def disp_project(pname):
	#get project by project name
	data = list(Database.getProject(pname))
	updates=[]
	tenders=[]
	print(data)
	if (current_user.access == "admin"):
		if(data[-1]=='a'):#if allocated send updates and specify type
			type='a'
		else:#else send tenders and specify type
			type='w'
			#tenders = Database.
			
	else:
		#dont send data but send 'contractor' as type
		type='c'
	print(type)
	return render_template('proj_info.html', project = data, type= type, updates=updates, tenders=tenders)