示例#1
0
文件: views.py 项目: Siddhant085/GTMS
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:
        print("Not logged in")
        updates = Database.getUpdate(pname)
    print(type)
    return render_template('proj_info.html', project = data, type= type,\
                   updates=updates, tenders=tenders)
示例#2
0
def getUpdate(pname):
    data = Database.getUpdate(pname)
    return jsonify(data)