コード例 #1
0
ファイル: config.py プロジェクト: brijesh333/RequestForChange
def admin_showreqs():
    committees = get_committees()
    if current_user.is_admin == True:
        requests = Requests.query.filter(Requests.approved == False)
        return render_template("admin_pendingrequests.html", posts = requests, committees = committees)
    else:
        return render_template("404.html")
コード例 #2
0
def showtag(tagid):
    committees = get_committees()
    if tagid == 'all':
        posts = Requests.query.all()
    else:
        posts = Requests.query.filter(Requests.tags == tagid)
    return render_template('requests.html', posts=posts, committees=committees)
コード例 #3
0
ファイル: config.py プロジェクト: brijesh333/RequestForChange
def showtag(tagid):
    committees = get_committees()
    if tagid == 'all':
        posts = Requests.query.all()
    else :
        posts = Requests.query.filter(Requests.tags == tagid)
    return render_template('requests.html', posts = posts, committees = committees)
コード例 #4
0
ファイル: config.py プロジェクト: brijesh333/RequestForChange
def change():
    if request.method == 'POST':
        
        #owner = request.form['owner']
        title = request.form['title']
        subtitle = request.form['subtitle']
        content = request.form['content']
        #supporters = request.form['supporters']
        status = request.form['status'] #public/private
        approved = False
        tags = request.form['tags']
        subtitle = request.form['subtitle']
        priority_str = request.form['priority_str']
        '''id_ = current_user.get_id()
        user = User.query.filter_by(User.id == id_).first()
        print user.webmailid'''

        priority = 0
        if priority_str == 'Low':
            priority = 1
        elif priority_str == 'Medium':
            priority = 2
        else:
            priority = 3
        #priority = request.form['priority']
        date = datetime.datetime.now().strftime("%I:%M%p on %B %d, %Y")
        comments_no = 0

        newrequest = Requests(current_user.id, title, subtitle, content, str(current_user.id), status, False, tags, priority, date, comments_no)
        db.session.add(newrequest)
        db.session.commit()
        #return "POSTED"
        return redirect('/show')
    else:
        return render_template('change.html', committees = get_committees())
コード例 #5
0
def admin_showreqs():
    committees = get_committees()
    if current_user.is_admin == True:
        requests = Requests.query.filter(Requests.approved == False)
        return render_template("admin_pendingrequests.html",
                               posts=requests,
                               committees=committees)
    else:
        return render_template("404.html")
コード例 #6
0
ファイル: config.py プロジェクト: brijesh333/RequestForChange
def show_reqs():
	committees = get_committees()
	searchtext = request.args.get('search')
	if searchtext is None:
		requests = Requests.query.filter(Requests.approved == True)
		return render_template("requests.html", posts = requests, committees = committees)
	else:
		allrequests = Requests.query.filter(Requests.approved == True)
		requests = []
		for req in allrequests:
			#or searchtext in req.subtitle or searchtext in req.content
			if searchtext in req.title :
				requests.append(req)		
		return render_template("requests.html", posts = requests, committees = committees)
コード例 #7
0
def show_reqs():
    committees = get_committees()
    searchtext = request.args.get('search')
    if searchtext is None:
        requests = Requests.query.filter(Requests.approved == True)
        return render_template("requests.html",
                               posts=requests,
                               committees=committees)
    else:
        allrequests = Requests.query.filter(Requests.approved == True)
        requests = []
        for req in allrequests:
            #or searchtext in req.subtitle or searchtext in req.content
            if searchtext in req.title:
                requests.append(req)
        return render_template("requests.html",
                               posts=requests,
                               committees=committees)
コード例 #8
0
def change():
    if request.method == 'POST':

        #owner = request.form['owner']
        title = request.form['title']
        subtitle = request.form['subtitle']
        content = request.form['content']
        #supporters = request.form['supporters']
        status = request.form['status']  #public/private
        approved = False
        tags = request.form['tags']
        subtitle = request.form['subtitle']
        priority_str = request.form['priority_str']
        '''id_ = current_user.get_id()
        user = User.query.filter_by(User.id == id_).first()
        print user.webmailid'''

        priority = 0
        if priority_str == 'Low':
            priority = 1
        elif priority_str == 'Medium':
            priority = 2
        else:
            priority = 3
        #priority = request.form['priority']
        date = datetime.datetime.now().strftime("%I:%M%p on %B %d, %Y")
        comments_no = 0

        newrequest = Requests(current_user.id, title, subtitle, content,
                              str(current_user.id), status, False, tags,
                              priority, date, comments_no)
        db.session.add(newrequest)
        db.session.commit()
        #return "POSTED"
        return redirect('/show')
    else:
        return render_template('change.html', committees=get_committees())